Skip to content

fix(server): add icons field to registerTool and registerToolTask#1873

Open
nielskaspers wants to merge 1 commit intomodelcontextprotocol:mainfrom
nielskaspers:fix/issue-1864-register-tool-icons
Open

fix(server): add icons field to registerTool and registerToolTask#1873
nielskaspers wants to merge 1 commit intomodelcontextprotocol:mainfrom
nielskaspers:fix/issue-1864-register-tool-icons

Conversation

@nielskaspers
Copy link
Copy Markdown
Contributor

Summary

registerTool() and registerToolTask() do not accept the icons field, even though ToolSchema includes it via IconsSchema.shape. This adds icons support to both APIs and includes it in tools/list responses.

Issue

Fixes #1864

Changes

  • Added icons?: Icon[] to the registerTool() config parameter type
  • Added icons to _createRegisteredTool() signature and object construction
  • Added icons to the tools/list handler's toolDefinition object
  • Added icons to RegisteredTool type and its update() method
  • Added icons to all registerToolTask() overload signatures and its call to _createRegisteredTool()

Testing

  • All 55 existing server tests pass
  • Full monorepo build succeeds

@nielskaspers nielskaspers requested a review from a team as a code owner April 10, 2026 06:51
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: 55ded99

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 10, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 55ded99

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