Skip to main content
Glama

get_icon_usage_examples

Retrieve practical usage examples for specific Heroicons components by providing the icon name and style, such as solid or outline.

Instructions

Get usage examples for an icon

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesIcon component name, e.g. BeakerIcon
styleYesIcon style: solid or outline

Implementation Reference

  • The async handler function for the get_icon_usage_examples tool, which generates React import and JSX usage examples for the specified icon name and style.
    async ({ name, style }) => {
      const pkg = `@heroicons/react/24/${style}`;
      const importLine = `import { ${name} } from '${pkg}';`;
      const jsxLine = `<${name} className="w-6 h-6 text-blue-500" />`;
      const example = `${importLine}\n\nfunction Example() {\n  return (\n    <div>\n      ${jsxLine}\n    </div>\n  );\n}`;
      return {
        content: [
          {
            type: "text",
            text: example
          }
        ]
      };
    }
  • Zod input schema defining parameters: name (string) and required style (solid or outline).
    {
      name: z.string().describe("Icon component name, e.g. BeakerIcon"),
      style: z
        .enum(["solid", "outline"])
        .describe("Icon style: solid or outline")
    },
  • src/utils.ts:156-179 (registration)
    Registration of the get_icon_usage_examples tool on the MCP server, including description, schema, and handler function.
    server.tool(
      "get_icon_usage_examples",
      "Get usage examples for an icon",
      {
        name: z.string().describe("Icon component name, e.g. BeakerIcon"),
        style: z
          .enum(["solid", "outline"])
          .describe("Icon style: solid or outline")
      },
      async ({ name, style }) => {
        const pkg = `@heroicons/react/24/${style}`;
        const importLine = `import { ${name} } from '${pkg}';`;
        const jsxLine = `<${name} className="w-6 h-6 text-blue-500" />`;
        const example = `${importLine}\n\nfunction Example() {\n  return (\n    <div>\n      ${jsxLine}\n    </div>\n  );\n}`;
        return {
          content: [
            {
              type: "text",
              text: example
            }
          ]
        };
      }
    );
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 of behavioral disclosure. It states what the tool does but does not reveal any behavioral traits such as whether it's a read-only operation, potential rate limits, error conditions, or the format of returned examples. For a tool with no annotations, this is a significant gap, warranting a score of 2.

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 directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly. This optimal conciseness earns a score of 5.

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

Completeness3/5

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

Given the tool's moderate complexity (2 required parameters) and no output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage context, and output format, which are important for an agent to use the tool effectively. Without annotations or an output schema, the description should do more, resulting in a score of 3.

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?

The schema description coverage is 100%, with clear descriptions for both parameters ('name' and 'style'), including an enum for 'style'. The description does not add any meaning beyond what the schema provides, such as explaining how 'name' relates to icon components or providing examples of usage. Given the high schema coverage, the baseline score of 3 is appropriate.

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 verb 'Get' and the resource 'usage examples for an icon', making the purpose understandable. However, it does not explicitly differentiate from sibling tools like 'list_all_icons' or 'search_icons', which might also involve icons but serve different functions. This clarity without sibling distinction justifies a score of 4.

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 such as 'list_all_icons' or 'search_icons'. There is no mention of prerequisites, context, or exclusions, leaving the agent to infer usage based on the tool name alone. This lack of explicit guidelines results in a score of 2.

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

Related 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/SeeYangZhi/heroicons-mcp'

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