Repository navigation
Conversation
Plain `{}` registries treat Object.prototype names (constructor, toString,
__proto__, …) as already registered, so proxies that expose such upstream
tools fail at registration. Initialize tool/prompt/resource registries with
Object.create(null) and cover the names with red-green tests.
Fixes modelcontextprotocol#3019
🦋 Changeset detectedLatest commit: af73cca The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Closing draft so we can reopen as ready for review; Convert to ready is blocked for Hugo-DDT on this repo. |
|
I reproduced issue #3019 locally and noticed a related edge case in the PR #3021 covers registering and calling prototype-named tools, but doesn't appear to test whether calling an unregistered prototype-named tool correctly returns Would an additional regression test for this case be useful in your PR? |
Calling tools/call for an unregistered name like toString used to answer "disabled" via Object.prototype lookup; cover the fixed "not found" path.
|
Good catch, thanks @VishwamDhavale! Added a regression test that calling an unregistered |
Thanks for adding the test! Glad the edge case was useful. Appreciate it! 🙌 |
|
Closing this draft to reopen as a ready-for-review PR (open-PR limit blocked converting to ready). |
|
Closing so a ready (non-draft) PR can be opened from the same branch via the compare page. |
Plain
{}registries treat Object.prototype names (constructor, toString, proto, …) as already registered, so proxies that expose such upstream tools fail at registration. Initialize tool/prompt/resource registries with Object.create(null) and cover the names with red-green tests.Fixes #3019
Motivation and Context
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context