Repository navigation
Conversation
… update
resources/list, resources/templates/list and template-supplied list entries spread the registered metadata, and update({ metadata }) replaces that carrier wholesale, so a metadata-only update dropped the title that registration or a later update({ title }) had put there. Both read paths now derive the field: metadata wins when it carries a title, the registered title is the fallback. Refs modelcontextprotocol#3103.
🦋 Changeset detectedLatest commit: 8d6ef03 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: |
|
Read against head a26b936 (static read, I did not run the suite): the read-time derivation matches the update path, since One sequence the four tests do not pin: register with |
A metadata-only update replaces the metadata carrier wholesale. When the incoming metadata carried a title, the read-time fallback still pointed at the registration title, so a later replacement that omitted the title advertised the old value again and made the advertised title depend on write order. Both update paths now copy a metadata-carried title onto the registered resource or template. Tests pin the sequence register -> metadata title -> titleless metadata for both resources and templates.
|
Good catch, and you are right that the four tests did not pin it. I took the second option you offered: the metadata branch now writes a metadata-carried title through to the registered resource and template, so your sequence advertises Why write-through rather than recording the resurrection as intended behaviour: tools and prompts each have a single title carrier ( One thing I am deliberately not widening this PR to cover: Evidence for the change:
|
|
Read 8d6ef03 (static read, I did not run the suite). The mirror closes the sequence I raised: the metadata branch now sets One case the new tests do not pin: a single call that passes both, |
Motivation and Context
Fixes #3103.
resources/list,resources/templates/listand template-supplied list entries all spread the registered metadata, andupdate({ metadata })replaces that carrier wholesale. A metadata-only update therefore drops the title that registration, or an earlierupdate({ title }), had put there, even though the handle still holds it.Measured on
mainbefore the change, with a resource registered as{ title: 'Docs', mimeType: 'text/markdown' }:Same for a template on
resources/templates/list. Registration is fine because the config object doubles as the metadata carrier; the loss is specific to a metadata replacement that does not repeat the title.Approach
Derive the field at read time instead of re-syncing it on every write path:
The same derivation is applied to
resources/templates/listand to the template metadata spread inresources/list, where listed instances had the same gap.This is deliberately narrower than the closed #3110, which synced the handle on metadata-only updates: that leaves registration-then-replace on the update path to fix each new writer, while deriving on read removes the class.
How to verify
packages/server/test/server/resourceTitle.test.ts(new) asserts, for both the resource and the template path: the title is advertised at registration, survives a metadata-only update, follows a laterupdate({ title }), and still loses to a metadata title when metadata carries one.With the source change stashed, 3 of the 4 tests fail; with it applied, all 4 pass. Full
packages/serversuite: 678 passed, 56 files.tsc -p packages/server/tsconfig.json --noEmitclean, prettier clean. Changeset added as a patch for@modelcontextprotocol/server.Happy to adjust the precedence (metadata-wins vs handle-wins) if maintainers prefer the opposite, or to fold this into whatever shape #3005 intended.