Repository navigation
Conversation
to_langchain() dropped every None argument because, with the old pydantic args_schema, BaseTool materialised each unsupplied optional as None. The schema has been a plain JSON Schema dict since the MCP-only toolset, and on langchain-core 1.6.3 BaseTool passes exactly what the model sent: an omitted optional is absent, an explicit null is null. The filter now only removed nulls the model chose to send, which the OpenAI and Pydantic AI adapters forward. Forward the arguments as given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
Two lines of comment now carry the whole contract, and the two test cases are named by pytest ids instead of inline comments. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
Contributor
Author
|
Closing: the /code-review pass on ab6f751 showed this change is wrong.
The filter on main stays. Its comment still says pydantic materialises the None values, which is no longer the reason; fixing that wording is a one-line follow-up if wanted. Requested by guillaume@stackone.com in Slack (repo audit thread) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
StackOneTool.to_langchain()no longer dropsNonearguments in_run. The LangChain adapter now forwards exactly what the model sent, the same asto_pydantic_ai_toolalready does.Why
The filter was added in #199, when
args_schemawas a pydantic model:BaseToolthen filled every unsupplied optional withNone, so droppingNonewas the only way to tell "omitted" from "sent". Since the toolset became MCP-only,args_schemais the served JSON Schema dict. With a dict schemaBaseToolpasses the tool-call args through untouched, so an omitted optional is already absent. The filter now only removes something real: anullthe model sent on purpose (for example to clear a nullable field), which the server never sees.Probe against the locked
langchain-core(1.6.3):_runreceived before_runreceives now{"path_id": "x"}{"path_id": "x"}{"path_id": "x"}{"path_id": "x", "body_after": null}{"path_id": "x"}{"path_id": "x", "body_after": null}Risk
A caller that relied on LangChain stripping explicit nulls will now send them. Header arguments are unaffected: a
nullheader value is still dropped by the header sanitiser before the call.How verified
test_langchain_forwards_the_model_arguments_as_sentthat invokes the converted tool with a real tool call; the null case fails onmainand passes here.uv run ruff check .,uv run ruff format --check .,uv run ty check stackone_ai examples,uv run pytest -q: 872 passed.Gates (head c67101b)
Nonethrough the nested and flat header sanitising paths; nulls are dropped there, other arguments were already forwarded verbatim.Requested by guillaume@stackone.com in Slack (repo audit thread)
🤖 Generated with Claude Code
Summary by cubic
Makes the LangChain adapter forward explicit nulls to the tool call instead of dropping them, matching what
to_pydantic_ai_toolalready does. Previously everyNoneargument was filtered because a pydantic args schema materialised unsupplied optionals asNone; now the schema is a JSON Schema dict, soBaseToolpasses the tool-call arguments through untouched — an omitted optional stays absent, and a null the model sent on purpose reaches the server.mainand passes here.Risk
nullheader value is still dropped by the header sanitiser before the call.Written for commit ab6f751. Summary will update on new commits.