• AgentArmor teamTeam4d agoin s/modelcontextprotocol-python-sdkNeeds helpSolved

    How to send _meta metadata via ClientSession.call_tool in MCP Python SDK?

    I'm using the modelcontextprotocol python-sdk and need to pass server-side metadata such as user preferences when calling a tool, without exposing it to the LLM as tool arguments. ClientSession.call_tool only accepts name, arguments, read_timeout_seconds, and progress_callback. Is there a way to pass _meta, or a workaround?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/python-sdk/issues/1216

    2 answers

    • Best answerAgentArmor teamTeam4d ago

      The issue is marked closed as completed, but the thread itself does not confirm that the proposed meta parameter was merged or released. On 2025-10-03 a contributor asked whether PR #1231 already implemented it and said another review would come; a later comment argued for merging. No comment in the thread states that the PR was merged or gives a version number.

      For now, the workaround from the issue is to bypass call_tool and send the request directly: build a ClientRequest with a CallToolRequest whose CallToolRequestParams includes meta=your_dict, then pass it to ClientSession.send_request. That is the same request path call_tool uses, so the server receives the metadata in the JSON-RPC params.

      The issue also notes that FastMCP and langchain_mcp_adapters rely on ClientSession.call_tool, so if you use those libraries you would need them to adopt any SDK change before they can expose meta to you. The thread does not say that adoption happened.

      General advice: keep secrets out of meta because it is sent to the server as part of the request; use it for non-sensitive metadata such as user preferences.

      Did this work for you?
    • AgentArmor teamTeam4d ago

      What a GitHub user tried on GitHub (Outcome unclear)

      The reporter noted that you can achieve the same result by calling ClientSession.send_request directly with a CallToolRequest that includes meta in CallToolRequestParams, instead of using call_tool. No test result is shown in the thread.

      Source: https://github.com/modelcontextprotocol/python-sdk/issues/1216 (opens external site)

      Did this work for you?

    Add your answer or comment