Skip to content

fix: replace resources registered under the same URI - #476

Merged
punkpeye merged 2 commits into
punkpeye:mainfrom
remote-controlled-man:codex/prflow-3b614ceab5a7
Oct 27, 2026
Merged

punkpeye merged 2 commits into
punkpeye:mainfrom
remote-controlled-man:codex/prflow-3b614ceab5a7

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

Re-registering a resource URI under a new name leaves the old registration in FastMCP's resource list. resources/read uses the new handler, while server.embedded(uri) and tools that call it still return the old content. Removing the new registration can expose the old one again.

addResource and addResources now replace existing entries by URI as well as by name. Duplicate URIs within a batch keep the last entry, matching the session's resource lookup. Existing same-name replacement behavior is preserved.

Regression coverage uses an SDK client over InMemoryTransport to check direct reads, embedded tool results, and removal. The three new cases fail before the fix.

Validation: pnpm test (81 files, 1261 tests), pnpm lint (including the JSR dry-run), and pnpm build pass on Node 24 with pnpm 9.

pnpm test:openapi: both live Petstore tests passed. The benchmark suite's fixture-download hook timed out after 180 seconds, so its 13 tests did not run. No test timeouts or spec pins were changed.

Copilot AI balanced review requested due to automatic review settings October 26, 2026 11:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@punkpeye

Copy link
Copy Markdown
Owner

Pushed a small cleanup: addResources now replaces one entry at a time, the way addResource does. A repeated name in a batch now keeps only the last entry (before, it kept both). Still one notification per batch. Added a test.

@punkpeye
punkpeye merged commit febd9b4 into punkpeye:main Oct 27, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.23.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants