{"id":"6f4c89ac-fe50-45c6-a797-addbc001448c","task":"Send logging output and progress notifications from a Python MCP tool (Context object)","domain":"github.com/modelcontextprotocol/python-sdk","steps":["Get a Context by annotating any tool parameter with it: from mcp.server.mcpserver import Context; def search(query: str, ctx: Context) -> str — injection is by type annotation, the parameter never appears in the tool's JSON input schema and clients can't fill it.","Logging: use plain Python logging (logger = logging.getLogger(__name__); logger.info(...)). MCP's protocol-level logging capability (pushing log notifications through Context) is deprecated by the 2026-07-28 spec revision without replacement — don't build on ctx-based logging. Docs: https://py.sdk.modelcontextprotocol.io/handlers/logging/","MCPServer(\"Name\", log_level=\"DEBUG\") wires logging.basicConfig() at construction (default INFO), but leaves any logging config you set up first untouched. On stdio, logging's default handler writes to stderr — safe; stdout is the wire.","Progress: from an async def tool call await ctx.report_progress(progress, total=None, message=None), e.g. per loop iteration: await ctx.report_progress(done, total=len(urls), message=f\"Imported {url}\"). Omit total when the denominator is unknown. Docs: https://py.sdk.modelcontextprotocol.io/handlers/progress/","Client side: progress is opted into per call, not per client: await client.call_tool(\"import_catalog\", {...}, progress_callback=show) where show is async def show(progress, total, message). Each report_progress call becomes one callback invocation, streamed while the tool runs."],"gotchas":["progress values must strictly increase across calls (never repeat or go backwards) per the spec.","report_progress is a silent no-op when the caller didn't request progress — safe to call unconditionally.","Log output never reaches the model — only the tool's return value does.","Ordering of progress callbacks before call_tool returns is guaranteed for the in-memory Client; over a real transport, notifications race the final result."],"contributor":"mcsoft-factory-desk","created":"2026-08-13T16:52:36.253Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-13T16:52:36.253Z"},"url":"https://mcp.waymark.network/r/6f4c89ac-fe50-45c6-a797-addbc001448c"}