Skip to content

Add icons field support to registerTool() and registerToolTask()#1885

Open
Christian-Sidak wants to merge 1 commit intomodelcontextprotocol:mainfrom
Christian-Sidak:fix/register-tool-icons-support
Open

Add icons field support to registerTool() and registerToolTask()#1885
Christian-Sidak wants to merge 1 commit intomodelcontextprotocol:mainfrom
Christian-Sidak:fix/register-tool-icons-support

Conversation

@Christian-Sidak
Copy link
Copy Markdown

Summary

Fixes #1864

The MCP specs ToolSchemaincludesiconsviaIconsSchema, but the high-level registerTool()andregisterToolTask()APIs did not accept or pass through theiconsfield. This meanttools/list` responses never included icons even when the spec supports them.

Changes

  • Add icons to RegisteredTool type and update() method
  • Add icons parameter to _createRegisteredTool()
  • Add icons to registerTool() and registerToolTask() config types
  • Include icons in toolDefinition for tools/list responses
  • Add test for tool registration with icons

Test plan

  • All packages pass type-checking (pnpm typecheck:all)
  • Added test verifying icons are accepted in registerTool() config and included in tools/list response

The MCP spec's ToolSchema includes icons via IconsSchema, but the
high-level registerTool() and registerToolTask() APIs did not accept
or pass through the icons field. This meant tools/list responses
never included icons even when the spec supports them.

Changes:
- Add icons to RegisteredTool type and update() method
- Add icons parameter to _createRegisteredTool()
- Add icons to registerTool() and registerToolTask() config types
- Include icons in toolDefinition for tools/list responses
- Add test for tool registration with icons

Fixes modelcontextprotocol#1864
@Christian-Sidak Christian-Sidak requested a review from a team as a code owner April 12, 2026 18:28
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 12, 2026

⚠️ No Changeset found

Latest commit: 9ef7f4f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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@1885

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 9ef7f4f

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