Skip to content

fix: MCP call_tool fails for streamable-http and SSE transports#550

Merged
DoganK01 merged 2 commits intoUpsonic:masterfrom
Jimgitsit:fix/mcp-streamable-http-call-tool
Mar 17, 2026
Merged

fix: MCP call_tool fails for streamable-http and SSE transports#550
DoganK01 merged 2 commits intoUpsonic:masterfrom
Jimgitsit:fix/mcp-streamable-http-call-tool

Conversation

@Jimgitsit
Copy link
Copy Markdown

Summary

  • call_tool treated the streamable-http/SSE client context as a session object, but it returns a (read, write, session_id) tuple — same as stdio. This caused TypeError: 'tuple' object does not support the asynchronous context manager protocol, surfaced as "unhandled errors in a TaskGroup" on every tool call.
  • _process_tool_result failed with TypeError: Object of type AnyUrl is not JSON serializable when handling EmbeddedResource responses — fixed by casting uri to str().

Note: the connect method already handles the tuple correctly (line 483). This brings call_tool in line with that pattern.

Test plan

  • Verified MCPHandler.call_tool() works with streamable-http transport against GitHub's MCP server
  • Verified EmbeddedResource responses (e.g. get_file_contents) are processed without serialization errors
  • Verified stdio transport still works (Trello MCP)

🤖 Generated with Claude Code

call_tool treated the streamable-http context as a ready-made session,
but it's actually a (read, write, session_id) tuple — same as stdio.
This caused "unhandled errors in a TaskGroup" on every tool call.

Also fix AnyUrl not being JSON serializable in _process_tool_result
when handling EmbeddedResource responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DoganK01
Copy link
Copy Markdown
Member

Hey works fine! Thanks for the contribution

@DoganK01 DoganK01 merged commit e2095bd into Upsonic:master Mar 17, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants