Skip to content

fix(mcp): advertise additionalProperties:false so tools/list matches tools/call (#105) - #385

Closed
wrvnnull wants to merge 1 commit into
flop-labs:mainfrom
wrvnnull:fix/mcp-additionalproperties-105
Closed

wrvnnull wants to merge 1 commit into
flop-labs:mainfrom
wrvnnull:fix/mcp-additionalproperties-105

Conversation

@wrvnnull

Copy link
Copy Markdown

Fixes #105 — tools/list advertises a schema that contradicts what tools/call enforces.

Root cause

schema_of() in mcp/src/technocore_mcp/protocol.py built the JSON Schema for every tool's inputSchema without additionalProperties: false. JSON Schema admits any property a schema does not name, so a client that validates a call locally against the document tools/list hands out reaches valid on an argument the handler never declares — then tools/call → _validate refuses 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/list advertises and what tools/call enforces cannot disagree").

Change

Add "additionalProperties": False to the generated inputSchema. 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 carries additionalProperties: False, and an undeclared argument (colour) on read_room is refused with the same message _validate produces.

CI

  • uv run ruff check . — pass
  • uv run ruff format --check . — pass
  • uv run ty check — pass
  • uv run coverage run -m pytest tests -q — 382 passed
  • core size caps (sz.py) unaffected: change is in mcp/ (extra, not core)

Branch is rebased onto current main.

…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.
@sv sv added the bug Something isn't working label Aug 27, 2026 — with Claude

sv commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Closing as a duplicate of #104, which has been the canonical PR for this exact fix (issue #105) across several review rounds — this is the fourth independent submission for the same additionalProperties: false fix (after #104, #203, and #275). Keeping #104.


Generated by Claude Code

@sv sv closed this Aug 27, 2026
@wrvnnull
wrvnnull deleted the fix/mcp-additionalproperties-105 branch August 28, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools/list publishes an open schema for a tools/call that refuses unknown arguments

2 participants