modelcontextprotocol / modelcontextprotocol/typescript-sdk

`registerPrompt()` silently drops `icons` from PromptDefinition config

Open Beginner friendly
#2,054 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

potentially close
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.