Skip to content

[Capability] Check tool names against the spec's 128-character limit and character set - #639

Open
jaeminbird wants to merge 1 commit into
modelcontextprotocol:mainfrom
jaeminbird:fix/tool-name-validation-spec
Open

jaeminbird wants to merge 1 commit into
modelcontextprotocol:mainfrom
jaeminbird:fix/tool-name-validation-spec

Conversation

@jaeminbird

Copy link
Copy Markdown

NameValidator accepts 1–64 characters including /, but the spec's "Tool Names" rule (2025-11-25 onward) is 1–128 characters of A-Z a-z 0-9 _ - ., the same rule the TypeScript SDK uses. So a valid 100-character name logs a warning, while a/b and a name ending in \n ($ without /D) do not.

The regex becomes /^[a-zA-Z0-9._-]{1,128}$/D and the warning text is updated. It stays a warning, so registration behaviour doesn't change. In the test, my/tool moves from valid to invalid, since the spec no longer allows /.

  • New cases (128 chars, my/tool, my_tool\n) fail on main and pass here.
  • Unit and integration suites, phpstan and php-cs-fixer pass (PHP 8.5). Interop and conformance suites not run locally.

This branch has not been deployed

No deployments
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