Repository navigation
fix(py/anthropic): send tools with non-object inputs under an input field - #111
Open
huangjeff5 wants to merge 1 commit into
Open
huangjeff5 wants to merge 1 commit into
huangjeff5 wants to merge 1 commit into
Conversation
This was referenced Nov 22, 2026
This branch has not been deployed
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.
Claude tools whose input is a plain value instead of an object now work. Before, any tool like
get_weather(city: str)or one takinglist[str]made every request fail with an Anthropic 400, even if Claude never called the tool.Decisions
{"input": ...}: Previously, a tool schema like{"type": "string"}was sent to Claude as-is and the API rejected the whole request. Now it is declared as{"type": "object", "properties": {"input": <schema>}, "required": ["input"]}, and your tool still runs with the bare value ('Paris', not{'input': 'Paris'}) in bothgenerateandgenerate_stream. We wrap rather than reject at define time because the tool definition is valid Genkit and works with other models; only the Anthropic wire shape needs an object.city: str | None) is wrapped withoutrequired, so Claude can call it with no arguments and the tool getsNone. Marking it required would force Claude to invent a value the tool doesn't need.{"input": ...}so multi-turn conversations stay consistent with the schema Claude sees. A past call to a tool that isn't in the current request'stoolsis sent back unchanged, since there's no declared schema to match it against.