Skip to main content
Glama

get_icon_usage_examples

Retrieve practical usage examples for Lucide React icons by specifying the icon name, helping developers integrate icons effectively into their projects.

Instructions

Get usage examples for a Lucide React icon

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesIcon name, e.g. 'home' or 'user'

Implementation Reference

  • Executes the tool logic: finds the icon by normalized name in iconMetadata, generates usage example code if found using IconUsageGenerator, otherwise returns a not-found message.
    async ({ name }) => {
      const icon = iconMetadata.find(
        (i) => i.name.toLowerCase() === name.toLowerCase()
      );
    
      if (!icon) {
        return createTextResponse(
          `Icon "${name}" not found. Use search_icons to find available icons.`
        );
      }
    
      const example = IconUsageGenerator.generate(icon.name);
      return {
        content: [
          {
            type: "text" as const,
            text: example
          }
        ]
      };
    }
  • Input schema: requires a 'name' parameter as string (icon name).
    {
      name: z.string().describe("Icon name, e.g. 'home' or 'user'")
    },
  • src/utils.ts:156-184 (registration)
    Registers the get_icon_usage_examples tool on the MCP server, specifying name, description, input schema, and handler function.
    // Tool: get_icon_usage_examples
    server.tool(
      "get_icon_usage_examples",
      "Get usage examples for a Lucide React icon",
      {
        name: z.string().describe("Icon name, e.g. 'home' or 'user'")
      },
      async ({ name }) => {
        const icon = iconMetadata.find(
          (i) => i.name.toLowerCase() === name.toLowerCase()
        );
    
        if (!icon) {
          return createTextResponse(
            `Icon "${name}" not found. Use search_icons to find available icons.`
          );
        }
    
        const example = IconUsageGenerator.generate(icon.name);
        return {
          content: [
            {
              type: "text" as const,
              text: example
            }
          ]
        };
      }
    );
  • Supporting utility that generates formatted React code example for the given icon, including import, basic usage, and styled props usage.
    class IconUsageGenerator {
      static generate(iconName: string) {
        const componentName = iconName;
        const importLine = `import { ${componentName} } from 'lucide-react';`;
        const basicExample = `<${componentName} />`;
        const propsExample = `<${componentName} size={24} color="#3b82f6" strokeWidth={1.5} />`;
    
        return `${importLine}\n\nfunction Example() {\n  return (\n    <div>\n      {/* Basic usage */}\n      ${basicExample}\n      \n      {/* With props */}\n      ${propsExample}\n    </div>\n  );\n}`;
      }
    }
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. While 'Get' implies a read operation, it doesn't specify what 'usage examples' entail (e.g., code snippets, descriptions, or visual previews), potential errors (e.g., invalid icon names), or response format. The description lacks details on rate limits, authentication needs, or data freshness.

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.

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 'usage examples' include (e.g., React code snippets, prop details), how results are structured, or error handling. For a tool with no structured output documentation, the description should provide more context about the return values.

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 input schema has 100% description coverage, with the 'name' parameter clearly documented as 'Icon name, e.g., 'home' or 'user''. The description adds no additional parameter semantics beyond what the schema provides, such as format constraints or examples. With 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 tool's purpose with a specific verb ('Get') and resource ('usage examples for a Lucide React icon'). It distinguishes from sibling tools like 'fuzzy_search_icons' or 'list_all_icons_by_category' by focusing on usage examples rather than searching or listing icons. However, it doesn't explicitly contrast with siblings in the description text itself.

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. It doesn't mention prerequisites (e.g., needing a valid icon name), exclusions, or compare it to sibling tools like 'search_icons' which might return similar information. Usage is implied but not explicitly stated.

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/lucide-icons-mcp'

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