Skip to content

[P2] Replace bare print() with stderr logging and tool-result warnings #50

Description

@vivekVells

Links

Correction to the original issue

This issue previously proposed migrating to MCP logging notifications (notifications/message). That is now against spec guidance. From the 2026-07-28 logging specification:

Deprecated: The Logging feature is deprecated as of protocol version 2026-07-28 (SEP-2577). [...] New implementations SHOULD NOT adopt it; existing implementations SHOULD migrate to logging to stderr for stdio transports, or to OpenTelemetry for structured observability.

Also withdrawn: the claim that "most clients ignore stderr". The spec says clients MAY capture, forward, or ignore it, and current MCP debugging guidance says stdio hosts capture stderr.

Problem

Four bare print() calls remain, for a defaults-file conflict warning and three filter resolution messages.

They are not corrupting the protocol. The SDK takes a private duplicate of fd 1 for the wire and re-points fd 1 at stderr, so print() lands on stderr. The SDK does have documented fallback paths where the diversion is not established and the stream is served in place; on those a stray print() would splice non-JSON into a stream the client parses strictly.

The real problems are that print() has no level, no logger name, and no way to be filtered, and that some of these messages matter to the model and never reach it.

Revised approach, split by audience

Audience Channel
The model, for anything affecting the result The tool result text. Dropped media, ignored parameters, format fallbacks
A human debugging logging module to stderr, with levels and a logger name
Neither Delete the message

Acceptance criteria

  • Zero bare print() in src/mcp_pandoc/
  • Diagnostics use logging to stderr with sensible levels
  • Anything that changes the result the model receives is surfaced in the tool result, not only in logs
  • A lint rule or test that fails on a new bare print() in the package
  • No notifications/message and no logging capability declaration

Out of scope

OpenTelemetry. Worth revisiting only if structured observability is ever needed.

Activity

  1. changed the title [-][P1] Replace bare `print()` with MCP logging notifications[/-] [+][P2] Replace bare `print()` with stderr logging and tool-result warnings[/+] on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions