fix: handle MCP tool arguments named kind#3803
Draft
rajshah4 wants to merge 1 commit into
Draft
Conversation
Contributor
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
Contributor
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Contributor
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||
Member
Author
|
Keeping this as draft for maintainer feedback because it touches the shared discriminator path. The regression is MCP-specific: valid tool schemas can define an argument named |
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.
Summary
Fix MCP tool schema handling when a server exposes a valid tool argument named
kind.OpenHands uses
kindinternally as a discriminator on schema/action models. MCP tool servers can also definekindas a normal input argument in their JSON Schema, for example as a symbol-kind or node-kind filter. Before this change, that collision could break dynamic MCP action model creation or cause the externalkindargument to be stripped during argument sanitization.What changed
kindwhen the MCP schema did not define it.kindargument.Why
MCP tool input schemas define arbitrary object properties, and
tools/callsends arbitrary argument keys. A tool argument namedkindis therefore valid MCP. The client-side OpenHands schema adapter should tolerate that external schema shape without exposing or losing OpenHands' own discriminator.This is related to prior MCP schema compatibility work such as #1509 and the
DiscriminatedUnionMixinchanges in #1555, but fixes a separate collision between external MCP arguments and OpenHands' internal discriminator field.Tests
Result:
9 passed.Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:93e813f-pythonRun
All tags pushed for this build
About Multi-Architecture Support
93e813f-python) is a multi-arch manifest supporting both amd64 and arm6493e813f-python-amd64) are also available if needed