Skip to main content
Glama

get_icon_glyph_by_style

Retrieve the Unicode glyph for Hugeicons by specifying icon name and style, enabling accurate icon integration across platforms.

Instructions

Get the glyph (unicode character) for a specific icon with a particular style

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
icon_nameYesThe name of the icon (e.g., 'home-01', 'notification-02')
styleYesThe icon style

Implementation Reference

  • The main MCP tool handler for get_icon_glyph_by_style. It validates the input arguments, calls the getGlyphByStyle helper function, formats the response, and handles errors.
    private async handleGetIconGlyphByStyle(args: any) {
      try {
        const iconName = this.validateIconName(args);
        const style = this.validateIconStyle(args);
        const glyph = await getGlyphByStyle(iconName, style);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(glyph, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to get icon glyph by style: ${error instanceof Error ? error.message : "Unknown error"}`
        );
      }
    }
  • Input schema defining the required icon_name (string) and style (string with enum of supported styles) parameters for the tool.
    inputSchema: {
      type: "object",
      properties: {
        icon_name: {
          type: "string",
          description: "The name of the icon (e.g., 'home-01', 'notification-02')",
        },
        style: {
          type: "string",
          description: "The icon style",
          enum: [
            "bulk-rounded",
            "duotone-rounded",
            "duotone-standard",
            "solid-rounded",
            "solid-sharp",
            "solid-standard",
            "stroke-rounded",
            "stroke-sharp",
            "stroke-standard",
            "twotone-rounded"
          ]
        }
      },
      required: ["icon_name", "style"],
    },
  • src/index.ts:123-152 (registration)
    Registration of the get_icon_glyph_by_style tool in the ListToolsRequestSchema response, including name, description, and input schema.
    {
      name: "get_icon_glyph_by_style",
      description: "Get the glyph (unicode character) for a specific icon with a particular style",
      inputSchema: {
        type: "object",
        properties: {
          icon_name: {
            type: "string",
            description: "The name of the icon (e.g., 'home-01', 'notification-02')",
          },
          style: {
            type: "string",
            description: "The icon style",
            enum: [
              "bulk-rounded",
              "duotone-rounded",
              "duotone-standard",
              "solid-rounded",
              "solid-sharp",
              "solid-standard",
              "stroke-rounded",
              "stroke-sharp",
              "stroke-standard",
              "twotone-rounded"
            ]
          }
        },
        required: ["icon_name", "style"],
      },
    },
  • Helper function implementing the core logic: fetches the specific glyph (primary and secondary unicode) for an icon and style from the Hugeicons API.
    export async function getGlyphByStyle(iconName: string, style: IconStyle): Promise<{ primary: Glyph; secondary: Glyph | null }> {
        if (!iconName || !iconName.trim()) {
            throw new Error('Icon name is required');
        }
    
        if (!style || !style.trim()) {
            throw new Error('Style is required');
        }
    
        try {
            const response = await axios.get<SingleGlyphResponse>(
                `${HUGEICONS_API_BASE}/icon/${iconName.trim()}/glyph`,
                {
                    params: { style: style.trim() },
                    headers: {
                        'accept': 'application/json'
                    },
                    timeout: 10000, // 10 second timeout
                }
            );
    
            if (!response.data.success) {
                throw new Error(response.data.message || 'Failed to fetch glyph');
            }
    
            return response.data.data;
        } catch (error: any) {
            if (error.response?.status === 404) {
                throw new Error(`Icon '${iconName}' with style '${style}' not found`);
            }
            if (error.message) {
                throw new Error(`Failed to fetch glyph: ${error.message}`);
            }
            throw new Error('Failed to fetch glyph');
        }
    }
  • Validation helper for the style parameter, ensuring it matches the supported IconStyle enum.
    private validateIconStyle(args: any): IconStyle {
      if (!args || typeof args.style !== "string" || !args.style.trim()) {
        throw new McpError(
          ErrorCode.InvalidRequest,
          "Style must be a non-empty string"
        );
      }
    
      const validStyles: IconStyle[] = [
        'bulk-rounded',
        'duotone-rounded',
        'duotone-standard',
        'solid-rounded',
        'solid-sharp',
        'solid-standard',
        'stroke-rounded',
        'stroke-sharp',
        'stroke-standard',
        'twotone-rounded'
      ];
    
      const style = args.style.trim() as IconStyle;
      if (!validStyles.includes(style)) {
        throw new McpError(
          ErrorCode.InvalidRequest,
          `Invalid style. Supported styles are: ${validStyles.join(', ')}`
        );
      }
    
      return style;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool retrieves a glyph, implying a read-only operation, but doesn't disclose behavioral traits such as error handling (e.g., for invalid icon names), performance (e.g., response time), or output format (e.g., Unicode character details). This is a significant gap for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. Every word contributes to understanding the tool's function, making it highly concise and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a Unicode string, error messages) or behavioral aspects like idempotency or side effects. For a tool with two required parameters and no structured output, more context is needed to ensure reliable use by an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for both parameters, including an enum for 'style'. The description adds no additional meaning beyond the schema, such as explaining icon naming conventions or style implications. Given the high schema coverage, the baseline score of 3 is appropriate, as the schema adequately documents the parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and the resource ('glyph for a specific icon with a particular style'), making the purpose understandable. It distinguishes from siblings like 'list_icons' or 'search_icons' by focusing on retrieving a single glyph. However, it doesn't explicitly differentiate from 'get_icon_glyphs' (plural), which might be a batch version, leaving some ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_icon_glyphs', 'list_icons', or 'search_icons'. It lacks context about prerequisites (e.g., needing valid icon names) or exclusions, leaving the agent to infer usage from the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hugeicons/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server