Skip to content

Client hangs when ctx.info() logging with pure Python client #201

Closed
@sheffler

Description

@sheffler

Describe the bug
When a tool includes client-side logging with, the client seems to hang.
The following tool works ok with Claude Desktop and Inspector, but does not complete with a Python client.

@mcp.tool()
async def simple_tool_with_logging(x:float, y:float, ctx:Context) -> str:
    await ctx.info(f"Processing Simple Tool")
    logger.debug("IN SIMPLE_TOOL")
    await ctx.report_progress(1, 2)
    return x*y

To Reproduce
Will check in a PR with test and proposed fix.

Expected behavior
I would expect the tool to run to completion.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: OSX
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions