fix(binding-mcp-openapi): advertise additionalProperties in generated tool input schema - #2543
Merged
Merged
Conversation
… tool input schema McpOpenapiCompositeGenerator#inputSchema() built the MCP tools/list inputSchema from an operation's requestBody by walking only its named properties, silently dropping additionalProperties even where the OpenAPI requestBody schema itself declares one (e.g. an open, arbitrary-key/value config map). A strict MCP client that validates its tools/call arguments against the declared inputSchema before sending a request has no way to know such extra fields are accepted, even though the outbound body projector (bodySchema()) already honors additionalProperties when shaping the actual request. inputSchema() now carries a requestBody schema's additionalProperties through into the generated tool schema, the same way bodySchema() already does, so the declared schema matches what the operation actually accepts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfmxFqiPhX8PAR1QXGC1Gr
…tools/list schema McpKafkaConnectProxyIT#shouldListTools asserts the exact tools/list response against the tools.list spec's hardcoded expected payload. The previous commit widened update_connector_config/validate_connector_config's declared inputSchema to carry additionalProperties through from their OpenAPI requestBody, so the fixed eighteen-tool payload this script expects needs to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XfmxFqiPhX8PAR1QXGC1Gr
Contributor
Author
|
CI's Generated by Claude Code |
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.
Description
McpOpenapiCompositeGenerator#inputSchema()builds the MCPtools/listinputSchemafor an operation from its OpenAPIrequestBodyschema, but only ever walked the schema's namedproperties— it never consultedadditionalProperties. This meant that even after #2538 widenedupdate_connector_config/validate_connector_config'srequestBodyschema to declare"additionalProperties": true, the declared MCP tool schema still only advertised a fixed, narrow set of named properties (connector.class,tasks.max), with no indication that other connector-specific fields (file,topic,name, etc.) are accepted.A strict MCP client that validates its
tools/callarguments against the declaredinputSchemabefore sending a request has no way to know such extra fields are valid, since the schema doesn't declare them — even though the outbound request body projector (bodySchema()) already honorsadditionalPropertieswhen shaping the actual HTTP request.inputSchema()now carries arequestBodyschema'sadditionalPropertiesthrough into the generated tool schema the same waybodySchema()already does, so the declared schema matches what the operation actually accepts.This is a fix to
binding-mcp-openapi's own schema-generation contract — it applies to any operation routed through this binding whoserequestBodyschema combines named properties withadditionalProperties, not just kafka-connect's operations.Added
McpOpenapiCompositeGeneratorTest#shouldAdvertiseAdditionalPropertiesInInputSchema, confirmed it fails without the fix (getBoolean("additionalProperties")finds no such key) and passes with it. Also re-ranbinding-mcp-kafka-connect's existing composite generator tests to confirm no regression.Fixes #2542
Test plan
McpOpenapiCompositeGeneratorTest(57 tests,runtime/binding-mcp-openapi) — all green, including the new regression testMcpKafkaConnectCompositeGeneratorTest(runtime/binding-mcp-kafka-connect) — all greencheckstyle:checkandlicense:checkclean on changed files🤖 Generated with Claude Code
https://claude.ai/code/session_01XfmxFqiPhX8PAR1QXGC1Gr
Generated by Claude Code