fix: align tool name validation with SEP-986 spec#1505
fix: align tool name validation with SEP-986 spec#1505corvid-agent wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
Fixes modelcontextprotocol#1502 - Allow forward slash (/) in tool names per SEP-986 - Reduce max length from 128 to 64 per SEP-986 - Add warning for names starting/ending with / - Update tests to match new validation rules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 7a4b411 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
We should backport this to v1.x branch also. Please can you open another PR against that and I will get both in :) |
Remove backslash before / in character classes (ESLint no-useless-escape) and fix Prettier formatting in test file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes modelcontextprotocol#1502 Backport of modelcontextprotocol#1505 to v1.x branch: - Allow forward slash (/) in tool names per SEP-986 - Reduce max length from 128 to 64 per SEP-986 - Add warning for names starting/ending with / - Update tests to match new validation rules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Done! Opened #1506 as the v1.x backport. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names Please check the latest spec, as it appears SEP-986 was later modified/iterated on. This PR will bring us out of spec. |
mattzcarey
left a comment
There was a problem hiding this comment.
blocking. SEP was changed before it landed
|
Hey as we seem to be spec compliant I am closing this PR. Tracking this in the original issue #1502 |
Summary
Fixes #1502
The tool name validation was not conforming to the SEP-986 specification in two ways:
/as an invalid character, but SEP-986 explicitly allows it (useful for namespaced tool names likeuser/profile/update)Changes
TOOL_NAME_REGEXfrom/^[A-Za-z0-9._-]{1,128}$/to/^[A-Za-z0-9._\/-]{1,64}$//to the valid character set in the invalid character filter/(consistent with existing warnings for leading/trailing-and.)Test plan
/(e.g.,user/profile/update) are accepted as valid/produce a warning but are still valid///is now valid (with warning) instead of invalidpnpm --filter @modelcontextprotocol/core test -- packages/core/test/shared/toolNameValidation.test.ts🤖 Generated with Claude Code