Skip to content

fix: keep the last resource template in a registration batch - #478

Merged
punkpeye merged 2 commits into
punkpeye:mainfrom
remote-controlled-man:codex/prflow-5821f554fa3a
Nov 2, 2026
Merged

punkpeye merged 2 commits into
punkpeye:mainfrom
remote-controlled-man:codex/prflow-5821f554fa3a

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

addResourceTemplates() retained earlier definitions when a batch repeated a template name. MCP sessions kept only the last definition, while server.embedded() searched the original array. A tool embedding docs://x could therefore return obsolete content even though resources/read returned the current content; changing the replacement URI also left the obsolete URI embeddable.

Apply the existing single-template name replacement semantics to each batch item, then send one list-changed notification. Different template names sharing a URI pattern retain their existing behavior. This complements the resource/tool batch fixes in #476 and #477; it changes only resource-template registration.

Regression cases use an MCP client to read resources and call a tool returning embedded resources, before and after connection, with both unchanged and changed template URIs. They also check unaffected templates, shared URI patterns, and notification count. All four cases fail on the original implementation and pass with the fix.

Validation on Node 24/macOS: pnpm build and pnpm lint pass; pnpm test: 1,345 passed; pnpm test:openapi: 15 passed. The network benchmark emitted its existing PostHog schema pin-drift warning and completed successfully.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 06:00

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 punkpeye changed the title Fix embedded resources after batched template replacements fix: keep the last resource template in a registration batch Nov 2, 2026
@punkpeye
punkpeye merged commit 8acb57f into punkpeye:main Nov 2, 2026
2 checks passed
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 4.23.9 🎉

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