Skip to content

registerPrompt() silently drops icons from PromptDefinition config #2054

@khill1269

Description

@khill1269

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions