get_icon
Fetch all details for an Aurum icon: drawable paths, Compose path, paired Figma node IDs, and deeplinks. Optionally specify weight to focus on line or fill variant.
Instructions
Fetch full details for a single Aurum icon by name: drawable resource paths, Compose path (AurumIcons.<Category>.<Name>), paired line/fill Figma node IDs, and deeplinks. Pass weight to focus on one variant.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Icon name, e.g. `ChevronRight`. Case-insensitive. | |
| weight | No | Which weight to highlight (`line`, `fill`, or `both`). | both |
Implementation Reference
- src/tools/get-icon.ts:27-78 (handler)The handler function for the 'get_icon' tool. It receives a manifest and args (name, weight), looks up the icon by name (case-insensitive), and returns formatted details including drawable paths, Figma links, and Compose usage code.
async handler(manifest, args) { const name = String(args.name ?? "").trim(); if (!name) { return { content: [{ type: "text", text: "Missing required `name` argument." }], isError: true, }; } const weight = (args.weight as string | undefined) ?? "both"; const ic = manifest.icons.find((x) => x.name.toLowerCase() === name.toLowerCase()); if (!ic) { const hits = manifest.icons .filter((x) => x.name.toLowerCase().includes(name.toLowerCase())) .slice(0, 5) .map((x) => `\`${x.category}.${x.name}\``) .join(", "); const hint = hits ? ` Did you mean ${hits}?` : ""; return { content: [{ type: "text", text: `No icon named \`${name}\`.${hint}` }], isError: true, }; } const lines: string[] = [ `# AurumIcons.${ic.category}.${ic.name}`, "", `**Category:** ${ic.category} `, "", ]; if (weight === "line" || weight === "both") { lines.push(`### Line variant`); lines.push(`- Drawable: \`${ic.lineDrawable}\``); if (ic.lineFigmaUrl) lines.push(`- Figma: [${ic.lineFigmaNodeId}](${ic.lineFigmaUrl})`); lines.push(""); } if (weight === "fill" || weight === "both") { lines.push(`### Fill variant`); lines.push(`- Drawable: \`${ic.fillDrawable}\``); if (ic.fillFigmaUrl) lines.push(`- Figma: [${ic.fillFigmaNodeId}](${ic.fillFigmaUrl})`); lines.push(""); } lines.push(`### Compose usage`); lines.push("```kotlin"); lines.push(`AurumIcon(`); lines.push(` imageVector = AurumIcons.${ic.category}.${ic.name}${weight === "fill" ? "Filled" : ""},`); lines.push(` contentDescription = null,`); lines.push(`)`); lines.push("```"); return { content: [{ type: "text", text: withFooter(manifest, lines.join("\n")) }] }; }, }; - src/tools/get-icon.ts:10-26 (schema)The inputSchema for the 'get_icon' tool, defining the required 'name' (string) and optional 'weight' (enum: line/fill/both) parameters.
inputSchema: { type: "object", required: ["name"], properties: { name: { type: "string", description: "Icon name, e.g. `ChevronRight`. Case-insensitive.", }, weight: { type: "string", enum: ["line", "fill", "both"], default: "both", description: "Which weight to highlight (`line`, `fill`, or `both`).", }, }, additionalProperties: false, }, - src/tools/index.ts:30-41 (registration)Import and registration of getIconTool in the tools array. Line 30 imports it, line 41 adds it to the exported tools list.
import { getIconTool } from "./get-icon.js"; import { getChangelogTool } from "./get-changelog.js"; import { lookupFigmaNodeTool } from "./lookup-figma-node.js"; import { searchTool } from "./search.js"; import { getAurumVersionTool } from "./get-aurum-version.js"; export const tools: ToolDef[] = [ listComponentsTool, getComponentTool, listTokensTool, searchIconsTool, getIconTool, - src/server.ts:40-46 (registration)The MCP server registration where tools (including getIconTool) are exposed via ListToolsRequestSchema and dispatched via CallToolRequestSchema.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools.map(({ name, description, inputSchema }) => ({ name, description, inputSchema, })), })); - src/format.ts:16-18 (helper)The withFooter helper function used by the get_icon handler to append a version footer with Aurum version, manifest SHA, and generation timestamp.
export function withFooter(manifest: Manifest, body: string): string { return body + versionFooter(manifest); }