Title: cannot get response from await session.call_tool() · Issue #262 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: cannot get response from await session.call_tool() · Issue #262 · modelcontextprotocol/python-sdk
X Title: cannot get response from await session.call_tool() · Issue #262 · modelcontextprotocol/python-sdk
Description: hello, I'm sorry to bother you. I've recently encountered a blocking issue with the MCP client. I've set up an MCP server, and it runs in Claude successfully. However, when I use the client I set up, the call to the tool result = await s...
Open Graph Description: hello, I'm sorry to bother you. I've recently encountered a blocking issue with the MCP client. I've set up an MCP server, and it runs in Claude successfully. However, when I use the client I set u...
X Description: hello, I'm sorry to bother you. I've recently encountered a blocking issue with the MCP client. I've set up an MCP server, and it runs in Claude successfully. However, when I use the cl...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/262
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"cannot get response from await session.call_tool()","articleBody":"hello, I'm sorry to bother you. I've recently encountered a blocking issue with the MCP client.\nI've set up an MCP server, and it runs in Claude successfully. However, when I use the client I set up, the call to the tool result = await session.call_tool() gets stuck and doesn't return a response. But when I use tools = await session.list_tools(), I can retrieve the list of tools.\n\nThrough logging within the client file, I'm able to confirm that the tool call has been initiated and executed successfully, and the result is obtained, but the client side can't receive the result. It seems there's an issue with the transmission layer of the protocol. I've been struggling with this for two days and have looked for solutions without success, even after upgrading the system version.\n\n\nI removed the other logic and only kept the tool invocation. The code is as follows.\n\nLooking forward to your reply.\n\n```\n\nfrom mcp import ClientSession, StdioServerParameters, types\nfrom mcp.client.stdio import stdio_client\n\n\nserver_params = StdioServerParameters( # Create server parameters for stdio connection\n command=\"uvx\",\n args=[\n \"--from\",\n \"git+ssh://xxxx.xx.xxx\",\n \"server-name\"\n ],\n env=None\n)\n\n# Optional: create a sampling callback\nasync def handle_sampling_message(message: types.CreateMessageRequestParams) -\u003e types.CreateMessageResult:\n return types.CreateMessageResult(\n role=\"assistant\",\n content=types.TextContent(\n type=\"text\",\n text=\"Hello, world! from model\",\n ),\n model=\"gpt-3.5-turbo\",\n stopReason=\"endTurn\",\n )\n\nasync def run():\n async with stdio_client(server_params) as (read, write):\n async with ClientSession(read, write, sampling_callback=handle_sampling_message) as session:\n # Initialize the connection\n await session.initialize()\n # List available tools\n tools = await session.list_tools()\n # Call a tool\n result = await session.call_tool(\"query-api-infos\", arguments={\"api_info_id\": \"8768555\"})\n print(result)\n\nif __name__ == \"__main__\":\n import asyncio\n asyncio.run(run())\n```","author":{"url":"https://github.com/herrrX","@type":"Person","name":"herrrX"},"datePublished":"2025-03-12T03:08:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":15},"url":"https://github.com/262/python-sdk/issues/262"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9c260d56-ef50-03fc-3ce5-300d96952b2f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E95A:9CB5A:4EE18:6C5D8:696E3C1B |
| html-safe-nonce | 2aa50ad008dd5da8a16fca1c71472f73fafeef0c1f70e26804f35b1696e3ced1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTVBOjlDQjVBOjRFRTE4OjZDNUQ4OjY5NkUzQzFCIiwidmlzaXRvcl9pZCI6IjgyNTk2NjEwMTg5Nzk3Nzc1NjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3f1ab5b623343063dd39d595614a702aed187bbcf770f7d716cee29647cddc08 |
| hovercard-subject-tag | issue:2912474917 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/262/issue_layout |
| twitter:image | https://opengraph.githubassets.com/969d60f97f74dbc4c6b2fcaf8f8f4fd32c584842ed9446a26e517c4a77e2d646/modelcontextprotocol/python-sdk/issues/262 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/969d60f97f74dbc4c6b2fcaf8f8f4fd32c584842ed9446a26e517c4a77e2d646/modelcontextprotocol/python-sdk/issues/262 |
| og:image:alt | hello, I'm sorry to bother you. I've recently encountered a blocking issue with the MCP client. I've set up an MCP server, and it runs in Claude successfully. However, when I use the client I set u... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | herrrX |
| hostname | github.com |
| expected-hostname | github.com |
| None | b39958d54b39d52b9fc890ff25687d2383a83e003512d4480499b2dbd046839f |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fba10be4ea34590240b2f4a625fc807362c2d5b8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width