Skip to content

feat(mcp): portable input schemas - #19

Merged
qiansc merged 2 commits into
mainfrom
fix/mcp-schema-portability
Nov 11, 2026
Merged

qiansc merged 2 commits into
mainfrom
fix/mcp-schema-portability

Conversation

@qiansc

@qiansc qiansc commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

MCP input schemas now express nullable fields as single-type anyOf branches. Null branches contain only {"type":"null"}; array items and numeric bounds remain on the non-null branches, making the schemas easier for tool adapters to consume.

  • Valid inputs, tool outputs and authorization are unchanged. Omission/null retains defaults; plugins: [] still disables enhancements.
  • read_many.files must be an array of 1–10 entries. files: null previously passed schema validation and failed in the service; it now returns an MCP input-validation tool error before the handler runs. Clients should inspect isError rather than rely on error text/code for invalid input.
  • Per-file range validation remains in the service, preserving partial batch success. HTTP endpoints are unchanged.

Validation: MCP package tests, race tests, go vet, static/web checks and local builds passed. The reviewer independently ran go test ./... successfully before the review follow-up. After the follow-up, MCP race tests and package vet passed again. Discovery tests cover all 10 tools, reject multi-type arrays and assert that null branches contain no extra keywords; HTTP tests preserve optional-value semantics and reject null batches before execution.

Review follow-up also moves the input-schema contract to its own documentation section. Existing source branch retained to preserve review continuity; squash title is feat(mcp): portable input schemas.

Replace inferred multi-type arrays with single-type anyOf branches for all
MCP inputs, including nested read_many ranges. Preserve optional nulls,
plugin defaults versus explicit empty lists, and existing validation bounds.

Require read_many.files to be a non-null array of 1-10 entries. Previously
null passed schema validation and failed in the service; it now returns an
MCP input-validation tool error before execution. Error text/code at that
boundary changes, but null never represented a successful batch operation.
Per-item range validation and partial success remain in the service.

Add discovery coverage for all 10 tools, schema validation cases and HTTP
MCP calls verifying legacy optional-value behavior. Document the contract.
Keep null branches type-only and assert this for every advertised tool. Give the input contract its own documentation section. Valid input semantics remain unchanged; null file batches fail before execution.
@qiansc qiansc changed the title fix(mcp): portable nullable schemas and non-null file batches feat(mcp): portable input schemas Nov 11, 2026
@qiansc
qiansc merged commit c120ee5 into main Nov 11, 2026
3 checks passed
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.

1 participant