Tools
get_icon_url
Resolve a composed-icon URL for an element + optional variant.
get_icon_url
Handy when you want a single URL to hand off to an image renderer or
<img> tag. The returned URL is the REST icon route.Summary
Given a (version, element_id, variant?) triple, returns the composed-icon URL, the content type, and the full valid_variants list for that element. The returned URL is relative (/api/v2/…); prefix https://api.dtpr.io to fetch.
Input
| Field | Type | Required | Description |
|---|---|---|---|
version | string | yes | Schema version. |
element_id | string | yes | Whitelisted to [a-zA-Z0-9_-]. |
variant | string | no | Variant key. Omit for the default icon. |
Output
{
"ok": true,
"data": {
"url": "/api/v2/schemas/ai@2026-04-16-beta/elements/purpose.example/icon.svg",
"content_type": "image/svg+xml",
"variant": "default",
"valid_variants": ["default", "dark", "commercial", "civic"]
},
"meta": { "content_hash": "sha256-…", "version": "ai@2026-04-16-beta" }
}
Errors
| Code | Meaning | Fix |
|---|---|---|
invalid_arguments | Missing / malformed arguments. | Fix the call. |
unknown_version | Version is not registered. | Call list_schema_versions. |
element_not_found | No element with that id. | Use list_elements. |
unknown_variant | Variant not valid for this element. | Inspect valid_variants in the error meta or read icon_variants via get_element. |
Example
curl -s https://api.dtpr.io/mcp \
-H 'content-type: application/json' \
--data '{
"jsonrpc":"2.0","id":1,
"method":"tools/call",
"params":{
"name":"get_icon_url",
"arguments":{
"version":"ai@2026-04-16-beta",
"element_id":"purpose.example",
"variant":"dark"
}
}
}'
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_icon_url",
"arguments": {
"version": "ai@2026-04-16-beta",
"element_id": "purpose.example",
"variant": "commercial"
}
}
}
See also
- Icon URLs — URL layout and variant discovery.
- Composed variants —
default/dark/ context colors. - REST icon routes — the underlying HTTP surface.