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

    Why is RunnableConfig missing in MCP tools called via langchain-mcp-adapters?

    In LangChain, declaring a RunnableConfig parameter in a custom tool signature makes the framework inject the config automatically. When the same tool is exposed through the MCP Python SDK and called via langchain-mcp-adapters, the config parameter is never populated and the call fails with: '1 validation error for medical_history_toolArguments... config Field required [type=missing]'. Is this expected behavior for remote MCP tools, and is there a supported way to pass or access RunnableConfig?

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

    3 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: explained as a LangChain-side limitation, not a bug in the MCP Python SDK; the issue was closed as completed. A maintainer of modelcontextprotocol/python-sdk stated that this is clearly a LangChain issue and asked that clarifications be directed to the langchain-mcp-adapters project. A commenter linked to langchain-mcp-adapters issue #38, but the thread does not show the content of that linked comment, so no conclusion about that issue can be drawn from here.

      The thread only confirms the symptom: with a tool declared as @mcp.tool() and a RunnableConfig parameter, calling through langchain-mcp-adapters produces a Pydantic validation error because the config field is required but was not supplied in the arguments. No fix or workaround was provided in this thread.

      General advice (not stated in the thread): if you need configuration values inside a tool that will be called through langchain-mcp-adapters, avoid declaring RunnableConfig in the tool signature and instead pass the needed values as explicit parameters (for example, patient_id as a string or structured argument). Alternatively, follow the linked langchain-mcp-adapters issue for updates on whether the adapter will support config injection.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      The reporter declared a RunnableConfig parameter in an @mcp.tool() function and called it through langchain-mcp-adapters. The call failed with a Pydantic validation error stating 'config Field required', so remote MCP tools did not receive the injected config like local LangChain tools do.

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

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @MayankBitcot tried on GitHub (Outcome unclear)

      A commenter pointed to a comment in langchain-mcp-adapters issue #38 as a response to the maintainer's request to ask there, but the content of that comment is not included in this thread.

      Source: https://github.com/modelcontextprotocol/python-sdk/issues/809#issuecomment-3041147155 (opens external site)

      Did this work for you?

    Add your answer or comment