list_all_icons
Retrieve all icons from the Heroicons library, with optional filtering by style (solid or outline), to streamline icon selection and integration.
Instructions
List all icons from the heroicons library, optionally filtered by style
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| style | No | Icon style: solid or outline (optional) |
Implementation Reference
- src/utils.ts:191-206 (handler)Handler function for list_all_icons tool. Filters iconMeta by optional style parameter, limits to 1000 icons, and returns their names as JSON text content.async ({ style }) => { // Limit to 1000 icons for safety let results = iconMeta; if (style) { results = results.filter((icon) => icon.style === style); } const names = results.slice(0, 1000).map((icon) => icon.name); return { content: [ { type: "text", text: JSON.stringify(names, null, 2) } ] }; }
- src/utils.ts:185-189 (schema)Input schema for list_all_icons tool, defining an optional 'style' parameter.{ style: z .enum(["solid", "outline"]) .optional() .describe("Icon style: solid or outline (optional)")
- src/utils.ts:182-207 (registration)Registration of the list_all_icons tool on the MCP server using server.tool, including description, schema, and inline handler.server.tool( "list_all_icons", "List all icons from the heroicons library, optionally filtered by style", { style: z .enum(["solid", "outline"]) .optional() .describe("Icon style: solid or outline (optional)") }, async ({ style }) => { // Limit to 1000 icons for safety let results = iconMeta; if (style) { results = results.filter((icon) => icon.style === style); } const names = results.slice(0, 1000).map((icon) => icon.name); return { content: [ { type: "text", text: JSON.stringify(names, null, 2) } ] }; } );
- src/utils.ts:95-106 (helper)Precomputed array of all icon metadata (name, style, categories), used by the list_all_icons handler.export const iconMeta = [ ...allIcons.solid.map((name) => ({ name, style: "solid", categories: categorizeIcon(name) })), ...allIcons.outline.map((name) => ({ name, style: "outline", categories: categorizeIcon(name) })) ];
- src/utils.ts:7-15 (helper)Helper function that extracts all icon names from heroicons imports, used to build iconMeta.export const getAllIcons = () => { // Only keep keys ending with 'Icon' const solid = Object.keys(solidIcons).filter((k) => k.endsWith("Icon")); const outline = Object.keys(outlineIcons).filter((k) => k.endsWith("Icon")); return { solid, outline }; };