Skip to content

Add per-tool icons[] to tools/list response#7

Merged
Dev-vlad merged 3 commits intomainfrom
tool-icons
May 5, 2026
Merged

Add per-tool icons[] to tools/list response#7
Dev-vlad merged 3 commits intomainfrom
tool-icons

Conversation

@Dev-vlad
Copy link
Copy Markdown
Member

@Dev-vlad Dev-vlad commented May 5, 2026

Summary

  • Embeds the 512x512 icon.png as a base64 data:image/png;base64,... URI at build time via a new scripts/bundle-icon.mjs script (mirrors the existing bundle-resources.mjs pattern), writing src/icon-bundled.ts (gitignored, regenerated on every build/test/typecheck).
  • Adds src/tool-icons.ts with a TOOL_ICONS map assigning the same icon entry to all four tools (web_fetch, web_search, ai_chat_completion, account_status).
  • SDK 1.29.0 (latest) strips icons from registerTool config, so Path B is used: after all register* calls, the SDK's internal tools/list handler is captured from _requestHandlers and wrapped to inject icons[] onto every tool in the response.
  • Adds tests/tool-icons.test.ts verifying all 4 tools carry icons with mimeType: "image/png" and a data:image/png;base64, src.

Test plan

  • npm run lint — clean
  • npm run typecheck — clean
  • npm test — 109 tests pass (108 existing + 1 new)
  • npm run build — clean ESM + DTS output
  • npm run build:mcpb — fresh MCPB produced

Dev-vlad added 3 commits May 5, 2026 16:54
Surfaces the connector icon as the per-tool badge in clients that
read tool.icons[] (Claude Desktop, etc.). Same 512x512 PNG inlined
as data: URI so the wire response is self-contained with no external
host dependency.

Path B: SDK 1.29.0 (latest) does not expose icons in registerTool,
so we intercept the tools/list handler after all register* calls and
inject icons[] into each tool entry via the SDK's _requestHandlers map.
Spec example uses 48x48 for tool icons. Add a small 48x48 PNG
alongside the 512x512 connector icon. Per-tool icons[] now declares
both sizes so clients can pick the right one for the slot.

Generated via sips from the source 512x512 icon.
Tool badges are small (48px). The 512×512 was redundant — that size
is the connector-level icon (manifest.json 'icon: icon.png'), already
served separately. Simpler bundle script + smaller tools/list payload.
@Dev-vlad Dev-vlad self-assigned this May 5, 2026
@Dev-vlad Dev-vlad merged commit 97b297f into main May 5, 2026
2 checks passed
@Dev-vlad Dev-vlad deleted the tool-icons branch May 5, 2026 15:23
Dev-vlad added a commit that referenced this pull request May 5, 2026
Three commits landed on main after v0.2.0 published to npm at bc4ac23:
- de7645a (registerTool migration with explicit titles)
- ab91a9a (square 512×512 connector icon)
- 76720cf..67a0b9d (per-tool icons[] in tools/list — PR #7)

Tag v0.2.1 was previously pushed at 97b297f but the publish workflow
failed because package.json/manifest.json still said 0.2.0.

This commit:
- Bumps package.json + manifest.json to 0.2.1.
- Splits the changelog so the v0.2.0 entry reflects what's actually
  on npm at v0.2.0, and a new v0.2.1 entry covers the three
  post-publish additions.

After merge, retag v0.2.1 at the new HEAD to fire publish.yml.
Dev-vlad added a commit that referenced this pull request May 5, 2026
* changelog: sync with v0.2.0 actual scope

Original entry was written from the spec; missed several changes
that landed during execution: registerTool migration with explicit
titles, server.prompt(...) runtime registration, per-tool icons[]
in tools/list, square 512×512 connector icon, language format
correction (ISO 639-1 not 639-2), toolError body propagation, and
the prompts[] manifest schema fix.

Drops the "new square icon" deferred line — that did ship.

* Bump to 0.2.1 + split changelog v0.2.0/v0.2.1

Three commits landed on main after v0.2.0 published to npm at bc4ac23:
- de7645a (registerTool migration with explicit titles)
- ab91a9a (square 512×512 connector icon)
- 76720cf..67a0b9d (per-tool icons[] in tools/list — PR #7)

Tag v0.2.1 was previously pushed at 97b297f but the publish workflow
failed because package.json/manifest.json still said 0.2.0.

This commit:
- Bumps package.json + manifest.json to 0.2.1.
- Splits the changelog so the v0.2.0 entry reflects what's actually
  on npm at v0.2.0, and a new v0.2.1 entry covers the three
  post-publish additions.

After merge, retag v0.2.1 at the new HEAD to fire publish.yml.
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.

1 participant