Skip to content

[Try] Implement exact-revision 2026 tools/call support - #281

Draft
galatanovidiu wants to merge 10 commits into
trunkfrom
try/dual-protocol-revisions
Draft

[Try] Implement exact-revision 2026 tools/call support#281
galatanovidiu wants to merge 10 commits into
trunkfrom
try/dual-protocol-revisions

Conversation

@galatanovidiu

Copy link
Copy Markdown
Contributor

What?

See WordPress/php-mcp-schema#11.

This draft tries to consume the proposed revisioned php-mcp-schema 0.2.0 API and add a deliberately bounded 2026-07-28 tools/call path while preserving the established protocol behavior.

Why?

The two protocol revisions have different request metadata, lifecycle, validation, and result shapes. Treating them as broad eras or allowing unknown versions to fall through to an older codec can silently serialize the wrong contract. JSON decoding must also preserve object-versus-list identity so object-shaped fields cannot accept [].

How?

  • Migrates existing DTO imports to the exact V20251125 namespace and adds side-by-side result codecs.
  • Maps protocol versions 2024-11-05, 2025-06-18, and 2025-11-25 explicitly to the 2025-11-25 schema tree; 2026-07-28 maps to its own tree.
  • Rejects unknown protocol and schema revisions before handler or codec selection.
  • Preserves JSON object/list identity for clientCapabilities and arguments, accepting real objects and rejecting empty lists, non-empty lists, null, and scalar shapes.
  • Keeps ToolsHandler::call_tool() compatible with the 2025-11-25 DTO contract.
  • Limits 2026-07-28 support to stateless, completed tools/call requests. This draft does not implement discover/list/resources/prompts, notifications, sampling, elicitation, roots, streaming, tasks, or multi-round-trip Adapter dispatch.

The Composer configuration currently uses the sibling php-mcp-schema checkout as an unreleased 0.2.0 path repository. That is intentional for coordinated local testing and must be replaced by an installable revision or release before this can become production-ready.

Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): GPT-5
Used for: Coordinated implementation, regression coverage, and verification under maintainer direction; the resulting changes and test evidence were reviewed locally.

Testing Instructions

  • Focused context/router/HTTP/STDIO/codec PHPUnit suite — 133 passed, 498 assertions.
  • npm run test:php -- --do-not-cache-result — 1,084 passed, 1 multisite-only skip, 0 failed; 4,118 assertions.
  • npm run wp-env:cli -- vendor/bin/phpcs --no-cache — 69 files, clean.
  • npm run lint:php:stan — 69 files, 0 errors.
  • composer validate --strict — passed.

Changelog Entry

Added - Experimental exact-revision support for completed MCP 2026-07-28 tools/call requests.

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