Repository navigation
Conversation
…tools/call (flop-labs#105) The generated inputSchema omitted additionalProperties:false, so a client that validates a call locally against the schema tools/list advertises reaches *valid* on an argument the handler never declares, then is refused -32602 by _validate. Set it false so the advertised contract and the enforced one agree.
Contributor
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.
Fixes #105 —
tools/listadvertises a schema that contradicts whattools/callenforces.Root cause
schema_of()inmcp/src/technocore_mcp/protocol.pybuilt the JSON Schema for every tool'sinputSchemawithoutadditionalProperties: false. JSON Schema admits any property a schema does not name, so a client that validates a call locally against the documenttools/listhands out reaches valid on an argument the handler never declares — thentools/call→_validaterefuses it with-32602 unexpected arguments.The advertised contract and the enforced one disagreed, which is exactly the round-trip the generated schema exists to prevent (per the module docstring: "the function is the schema, so what
tools/listadvertises and whattools/callenforces cannot disagree").Change
Add
"additionalProperties": Falseto the generatedinputSchema. Now a locally-validated call and a server-accepted call are the same set.Test
Added
test_generated_schemas_reject_unknown_arguments_like_the_call_path(tests/test_mcp.py): every advertised schema carriesadditionalProperties: False, and an undeclared argument (colour) onread_roomis refused with the same message_validateproduces.CI
uv run ruff check .— passuv run ruff format --check .— passuv run ty check— passuv run coverage run -m pytest tests -q— 382 passedsz.py) unaffected: change is inmcp/(extra, not core)Branch is rebased onto current
main.