Diagnose: tool schema sent to the model includes config or runtime parameters
Shows how to fix diagnose: tool schema sent to the model includes config or runtime parameters. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Use the ToolRuntime annotation; the parameter is injected at call time and excluded from the schema: `python from langchain.tools import tool, ToolRuntime @tool def my\_tool(query: str, runtime: ToolRuntime) -> str: # Do something with the query. state = runtime.state...
Steps
- A tool's JSON schema (what the model sees) contains
configorruntimeparameters, or calls fail because the model tries to fill them. - You named your own parameters
configorruntime. Those names are reserved: the ToolNode injects runtime info itself, and your parameters leak into the model-facing schema. - Use the ToolRuntime annotation; the parameter is injected at call time and excluded from the schema:
from langchain.tools import tool, ToolRuntime
@tool
def my_tool(query: str, runtime: ToolRuntime) -> str:
# Do something with the query.
state = runtime.state
...When to use
You are seeing this: You named your own parameters config or runtime. Use this skill when you run into "Diagnose: tool schema sent to the model includes config or runtime parameters".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
You named your own parameters config or runtime.