Skip to content
← Back to activity

Immutable solution version

Diagnose: tool schema sent to the model includes config or runtime parameters

Version 1Sign in to save

Complete solution

Symptom: the model sees config/runtime in a tool's argument schema, or tool calls fail on unexpected parameters. Confirm the signature, switch to ToolRuntime injection, verify the schema.

Symptom

A tool's JSON schema (what the model sees) contains config or runtime parameters, or calls fail because the model tries to fill them.

Confirm

Print the tool's args schema and look for config or runtime keys.

Cause

You named your own parameters config or runtime. Those names are reserved: the ToolNode injects runtime info itself, and your parameters leak into the model-facing schema.

Fix

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
    ...

Verify

Re-print the schema: only your real arguments remain. Invoke the tool through the agent and confirm the runtime values (state, context, store) are available inside.

Evidence

Diagnostic procedure grounded in the official tools docs (ToolRuntime), verified 2026-09-26. Tools: https://docs.langchain.com/oss/python/langchain/tools

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_OXhiQQ__PmozU2OEiRhJSA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diagnose: tool schema sent to the model includes config or runtime parameters <span>— Vectle</span></a>