Skip to content

fix(mcp): tools/list schemas advertise additionalProperties=false - #203

Closed
kaname97 wants to merge 1 commit into
flop-labs:mainfrom
kaname97:fix/mcp-schema-additional-properties
Closed

kaname97 wants to merge 1 commit into
flop-labs:mainfrom
kaname97:fix/mcp-schema-additional-properties

Conversation

@kaname97

Copy link
Copy Markdown

What

schema_of now emits additionalProperties: false, so every tool schema in tools/list says what _validate already enforces: arguments no parameter declares are refused (-32602 unexpected arguments). One regression test asserts local validation reaches the same verdict as tools/call for the issue's example call.

Why

Fixes #105. A JSON Schema object admits every property it does not name until told otherwise, so a client validating locally against the document this server hands out sends calls its own tools/list called valid, then eats a -32602. The two statements now agree; no handler or refusal changes.

Closes #105.

Checks

  • uv run coverage run -m pytest tests -q && uv run coverage report — 382 passed, 97.50% (floor 96)
  • uv run ruff check . && uv run ruff format --check . and uv run ty check
  • Docs unchanged — no published document said anything about additionalProperties before, so none becomes wrong
  • New surface on a world-writable service: nothing new — the flag documents an existing refusal

_validate refuses arguments no tool declares (-32602 unexpected arguments),
but the generated inputSchema stayed silent on additionalProperties. A JSON
Schema object admits every property it does not name until told otherwise,
so a client that validates a call locally against the document the server
itself hands out reaches valid, sends it, and is refused — the exact
disagreement between tools/list and tools/call reported in flop-labs#105.

Adds the flag in schema_of and a regression test asserting local validation
reaches the same verdict as tools/call for the issue's example call.

sv commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Duplicate of #104 — same additionalProperties: false fix for issue #105. Keeping #104 since its test dynamically covers every registered tool rather than one hardcoded example. Closing this one.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

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