fix(client): prefer .title over .name for prompt, resource, and template labels (closes #1226, #1227)#1341
Open
adityachilka1 wants to merge 1 commit into
Conversation
…ate labels The MCP spec's `BaseMetadata` gives every named entity an optional `title` aimed at human-readable UI display; `name` is the programmatic identifier. The Tools tab already followed the idiomatic `title || name` pattern, but PromptsTab and ResourcesTab (including resource templates) rendered the raw `name` even when a title was available. Mirror the ToolsTab pattern for parity. Also adds the already-spec'red `title?: string` field to the local `Prompt` type in PromptsTab.tsx (SDK types for Resource and ResourceTemplate already carry it). Closes modelcontextprotocol#1226, closes modelcontextprotocol#1227.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1226 and closes #1227 (two-for-one).
Why
The MCP spec's
BaseMetadatagives every named entity an optionalattribute
title, aimed explicitly at UI display:The Tools tab already follows
tool.title || tool.name(e.g.client/src/components/ToolsTab.tsx:293). PromptsTab and ResourcesTab(and the Resource Templates list) rendered the raw
name.Changes
client/src/components/PromptsTab.tsxtitle?: stringto the localPrompttype (mirrors the SDKBaseMetadataSchemafield).{prompt.name}→{prompt.title || prompt.name}selectedPrompt.name→title || nameclient/src/components/ResourcesTab.tsxresource.name→title || nametemplate.name→title || nametitleattribute:title || nameforboth
selectedResourceandselectedTemplateThe SDK-exported
ResourceandResourceTemplatetypes already declaretitleviaBaseMetadataSchema, so no type changes were needed there.No type changes for SDK-imported types
The local
Prompttype in PromptsTab.tsx is hand-maintained and is wherethe new field goes.
Verification
file in the repo, so this is the closest coverage).
prettier-checkpasses for the whole repo.No behavioral regression
When
titleis absent (null | undefined | empty string), the|| namefallback kick in, returning the exact same string the UI previously showed.
Only change: when the server does provide a title, it's used.