modelcontextprotocol / modelcontextprotocol/typescript-sdk
`registerPrompt()` silently drops `icons` from PromptDefinition config
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
Summary
server.registerPrompt() accepts a config object but destructures only { title, description, argsSchema } before storing the prompt. Any additional fields — including icons: Icon[], which the MCP 2025-11-25 spec explicitly allows on prompt definitions — are silently discarded. Clients calling prompts/list never receive icons.
SDK Version
@modelcontextprotocol/sdk 1.29.0
Affected Line
dist/cjs/server/mcp.js:734:
const { title, description, argsSchema } = config; // ← icons dropped here
Spec Reference
MCP 2025-11-25 server/prompts.md — prompts can have icons?: Icon[]. The Icon interface (spec.types.d.ts:449–487) has src, mimeType, sizes, and optional theme.
Reproduction
server.registerPrompt('my_prompt', {
description: 'A prompt with an icon',
argsSchema: {},
icons: [{ src: 'data:image/svg+xml;base64,...', mimeType: 'image/svg+xml', sizes: ['24x24'] }],
}, async () => ({ messages: [] }));
// prompts/list response: icons field is absent
Expected Behavior
icons in registerPrompt() config should be stored and returned in prompts/list wire responses.
Workaround
Intercept prompts/list via server.server.setRequestHandler(ListPromptsRequestSchema, ...) and inject icons from a parallel Map<name, Icon[]>.
Fix Suggestion
// In registerPrompt():
const { title, description, argsSchema, icons } = config; // include icons
registeredPrompt.icons = icons; // persist
// In prompts/list serializer: include icons if present
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at registerPrompt() in dist/cjs/server/mcp.js:734 and trace how registered prompts are serialized for prompts/list responses. Compare the stored PromptDefinition fields with the MCP 2025-11-25 prompt definition, then verify that a prompt configured with icons returns them in the wire response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100