Skip to content

fix: support icons in registerTool config and tools/list response#1879

Open
Yanhu007 wants to merge 2 commits intomodelcontextprotocol:mainfrom
Yanhu007:fix/register-tool-icons-support
Open

fix: support icons in registerTool config and tools/list response#1879
Yanhu007 wants to merge 2 commits intomodelcontextprotocol:mainfrom
Yanhu007:fix/register-tool-icons-support

Conversation

@Yanhu007
Copy link
Copy Markdown

Summary

Fixes #1864

The MCP spec's ToolSchema includes icons (via IconsSchema), but McpServer.registerTool() has two gaps:

  1. The config parameter type does not accept icons
  2. The tools/list handler does not include icons in the tool definition

Changes

  • Add icons?: Tool['icons'] to registerTool config type
  • Add icons parameter to _createRegisteredTool
  • Include icons in the toolDefinition built by the tools/list handler
  • Add icons to the RegisteredTool type

Usage

server.registerTool(
  'my-tool',
  {
    description: 'A tool with an icon',
    icons: [{ src: 'https://example.com/icon.png', mimeType: 'image/png' }],
  },
  async () => ({ content: [{ type: 'text', text: 'hello' }] })
);

The MCP spec's ToolSchema includes icons (via IconsSchema), but
McpServer.registerTool() did not accept icons in its config parameter,
and the tools/list handler did not include icons in the tool definition.

- Add icons to registerTool config type
- Pass icons through _createRegisteredTool
- Include icons in the tools/list response toolDefinition
- Add icons to RegisteredTool type

Fixes modelcontextprotocol#1864
@Yanhu007 Yanhu007 requested a review from a team as a code owner April 12, 2026 00:21
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 12, 2026

🦋 Changeset detected

Latest commit: 8c763a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@modelcontextprotocol/server Patch
@modelcontextprotocol/express Patch
@modelcontextprotocol/fastify Patch
@modelcontextprotocol/hono Patch
@modelcontextprotocol/node Patch

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 12, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@1879

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@1879

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@1879

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@1879

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@1879

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@1879

commit: 8c763a2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

McpServer.registerTool() does not support icons field from ToolScheme

1 participant