You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to work on this once the registration API in #1200 is settled. Is this available for an external contribution? Could you confirm the intended validation hook and failure behavior for invalid tool definitions, and whether the validator should be shared with #1202?
For context on the shared-validator question: #1202 (closes #1199) adds McpParamHeaders, which already parses x-mcp-header declarations from a tool's input schema (name rules, case-insensitive duplicates, allowed primitive types) to validate incoming Mcp-Param-* headers at call time. Invalid declarations are currently skipped with a debug log, which is the gap this issue covers at registration time.
If it helps, I can expose that parsing as a reusable validator in #1202 so the registration-time check here builds on it, or adapt it to whatever hook you settle on in #1200.
Hi @Kehrlann, I was looking at this alongside PR #1322 (InMemorySyncToolRepository and InMemoryAsyncToolRepository).
Since ToolParamHeaderAnnotations.parse(tool) is already on main and collects all the spec violations into annotations.invalid(), validating at registration time in the new in-memory repositories (inside the builder .tool(...) and addTool(...) methods) looks very straightforward: we can parse tool.definition() when a tool is added and throw IllegalArgumentException with the joined InvalidAnnotation::describe messages if !annotations.isValid().
Once #1322 is merged, I'd be glad to pick this up and add the validation and test cases if you want to assign it to me.
Activity
pma1999 commentedon Oct 24, 2026
I'd like to work on this once the registration API in #1200 is settled. Is this available for an external contribution? Could you confirm the intended validation hook and failure behavior for invalid tool definitions, and whether the validator should be shared with #1202?
prathamgoyal787 commentedon Oct 26, 2026
For context on the shared-validator question: #1202 (closes #1199) adds
McpParamHeaders, which already parsesx-mcp-headerdeclarations from a tool's input schema (name rules, case-insensitive duplicates, allowed primitive types) to validate incomingMcp-Param-*headers at call time. Invalid declarations are currently skipped with a debug log, which is the gap this issue covers at registration time.If it helps, I can expose that parsing as a reusable validator in #1202 so the registration-time check here builds on it, or adapt it to whatever hook you settle on in #1200.
media-ctrl commentedon Nov 8, 2026
mohit32886 commentedon Nov 16, 2026
Hi @Kehrlann, I was looking at this alongside PR #1322 (
InMemorySyncToolRepositoryandInMemoryAsyncToolRepository).Since
ToolParamHeaderAnnotations.parse(tool)is already onmainand collects all the spec violations intoannotations.invalid(), validating at registration time in the new in-memory repositories (inside the builder.tool(...)andaddTool(...)methods) looks very straightforward: we can parsetool.definition()when a tool is added and throwIllegalArgumentExceptionwith the joinedInvalidAnnotation::describemessages if!annotations.isValid().Once #1322 is merged, I'd be glad to pick this up and add the validation and test cases if you want to assign it to me.