Skip to content

fix(mcp): guard empty tool parameters in adkToMcpToolType#1340

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_945015920
Jul 9, 2026
Merged

fix(mcp): guard empty tool parameters in adkToMcpToolType#1340
copybara-service[bot] merged 1 commit into
mainfrom
test_945015920

Conversation

@copybara-service

Copy link
Copy Markdown

fix(mcp): guard empty tool parameters in adkToMcpToolType

adkToMcpToolType called Optional.get() on parameters() unguarded, so a
present declaration with no parameters (a valid no-argument tool) threw
NoSuchElementException. Build the MCP tool without an input schema when
parameters are absent.

Also make the method static so the utility class (final, private
constructor) is actually callable, and add ConversionUtilsTest.

`adkToMcpToolType` called `Optional.get()` on `parameters()` unguarded, so a
present declaration with no parameters (a valid no-argument tool) threw
`NoSuchElementException`. Build the MCP tool without an input schema when
parameters are absent.

Also make the method static so the utility class (`final`, `private`
constructor) is actually callable, and add `ConversionUtilsTest`.

PiperOrigin-RevId: 945099824
@copybara-service copybara-service Bot merged commit 66fa921 into main Jul 9, 2026
@copybara-service copybara-service Bot deleted the test_945015920 branch July 9, 2026 14:15
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