get_icon_glyphs
Retrieve Unicode glyph characters for any Hugeicons icon across all available styles by specifying the icon name.
Instructions
Get all glyphs (unicode characters) for a specific icon across all available styles
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| icon_name | Yes | The name of the icon (e.g., 'home-01', 'notification-02') |
Implementation Reference
- src/index.ts:365-384 (handler)Main handler for get_icon_glyphs tool: validates icon_name, calls getAllGlyphs helper, formats response as JSON.private async handleGetIconGlyphs(args: any) { try { const iconName = this.validateIconName(args); const glyphs = await getAllGlyphs(iconName); return { content: [ { type: "text", text: JSON.stringify(glyphs, null, 2), }, ], }; } catch (error) { throw new McpError( ErrorCode.InternalError, `Failed to get icon glyphs: ${error instanceof Error ? error.message : "Unknown error"}` ); } }
- src/index.ts:109-122 (registration)Registration of get_icon_glyphs tool in ListToolsRequestSchema handler, including name, description, and input schema.{ name: "get_icon_glyphs", description: "Get all glyphs (unicode characters) for a specific icon across all available styles", inputSchema: { type: "object", properties: { icon_name: { type: "string", description: "The name of the icon (e.g., 'home-01', 'notification-02')", } }, required: ["icon_name"], }, },
- src/utils/glyphs.ts:9-39 (helper)Core helper function that performs HTTP request to Hugeicons API to retrieve all glyphs for the specified icon.export async function getAllGlyphs(iconName: string): Promise<Glyph[]> { if (!iconName || !iconName.trim()) { throw new Error('Icon name is required'); } try { const response = await axios.get<AllGlyphsResponse>( `${HUGEICONS_API_BASE}/icon/${iconName.trim()}/glyphs`, { headers: { 'accept': 'application/json' }, timeout: 10000, // 10 second timeout } ); if (!response.data.success) { throw new Error(response.data.message || 'Failed to fetch glyphs'); } return response.data.data.glyphs; } catch (error: any) { if (error.response?.status === 404) { throw new Error(`Icon '${iconName}' not found`); } if (error.message) { throw new Error(`Failed to fetch glyphs: ${error.message}`); } throw new Error('Failed to fetch glyphs'); } }