Skip to content

fix: fix Claude MCP tool inputSchema by falling back to parametersJsonSchema#1342

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_945069237
Jul 10, 2026
Merged

fix: fix Claude MCP tool inputSchema by falling back to parametersJsonSchema#1342
copybara-service[bot] merged 1 commit into
mainfrom
test_945069237

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Jul 9, 2026

Copy link
Copy Markdown

fix: fix Claude MCP tool inputSchema by falling back to parametersJsonSchema

Claude.functionDeclarationToAnthropicTool() only read
FunctionDeclaration.parameters() and ignored parametersJsonSchema(). MCP
tools populate parametersJsonSchema instead of parameters, so their input
schema was converted into an empty properties map and Claude received tools
with no arguments, making them impossible to invoke.

When parametersJsonSchema is present, pass the whole JSON Schema through so
keys such as $ref/$defs are preserved, and recursively lowercase type
keywords for Anthropic. updateTypeString now also handles union type arrays
instead of failing on the String cast. This mirrors the Python
anthropic_llm.py implementation.

@copybara-service copybara-service Bot force-pushed the test_945069237 branch 2 times, most recently from eb19d47 to 2f21543 Compare July 10, 2026 10:53
…JsonSchema`

`Claude.functionDeclarationToAnthropicTool()` only read
`FunctionDeclaration.parameters()` and ignored `parametersJsonSchema()`. MCP
tools populate `parametersJsonSchema` instead of `parameters`, so their input
schema was converted into an empty `properties` map and Claude received tools
with no arguments, making them impossible to invoke.

When `parametersJsonSchema` is present, pass the whole JSON Schema through so
keys such as `$ref`/`$defs` are preserved, and recursively lowercase `type`
keywords for Anthropic. `updateTypeString` now also handles union `type` arrays
instead of failing on the `String` cast. This mirrors the Python
`anthropic_llm.py` implementation.

PiperOrigin-RevId: 945624831
@copybara-service copybara-service Bot merged commit 760c8da into main Jul 10, 2026
@copybara-service copybara-service Bot deleted the test_945069237 branch July 10, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant