Skip to main content
Glama

search_icons

Find icons by name or category from Heroicons library. Filter results by style (solid or outline) and set a limit for the number of icons returned.

Instructions

Search for icons from heroicons by name or category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoCategory to filter by (optional)
limitNoMax results to return
queryYesSearch term for icon name or category
styleNoIcon style: solid or outline

Implementation Reference

  • Handler function that filters icons from iconMeta based on search query in name, optional category, style, and limit, then returns a JSON-formatted text response.
    async ({ query, style, category, limit }) => {
      let results = iconMeta.filter((icon) => {
        const matchName = icon.name.toLowerCase().includes(query.toLowerCase());
        const matchCat = category ? icon.categories.includes(category) : true;
        const matchStyle = style ? icon.style === style : true;
        return matchName && matchCat && matchStyle;
      });
      if (limit) results = results.slice(0, limit);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(results, null, 2)
          }
        ]
      };
    }
  • Zod input schema for the search_icons tool parameters: query (required string), style (optional enum), category (optional string), limit (optional number, default 20, 1-100).
    {
      query: z.string().describe("Search term for icon name or category"),
      style: z
        .enum(["solid", "outline"])
        .optional()
        .describe("Icon style: solid or outline"),
      category: z
        .string()
        .optional()
        .describe("Category to filter by (optional)"),
      limit: z
        .number()
        .min(1)
        .max(100)
        .default(20)
        .optional()
        .describe("Max results to return")
    },
  • src/utils.ts:115-153 (registration)
    Registers the search_icons tool on the MCP server with name, description, input schema, and handler function.
    server.tool(
      "search_icons",
      "Search for icons from heroicons by name or category",
      {
        query: z.string().describe("Search term for icon name or category"),
        style: z
          .enum(["solid", "outline"])
          .optional()
          .describe("Icon style: solid or outline"),
        category: z
          .string()
          .optional()
          .describe("Category to filter by (optional)"),
        limit: z
          .number()
          .min(1)
          .max(100)
          .default(20)
          .optional()
          .describe("Max results to return")
      },
      async ({ query, style, category, limit }) => {
        let results = iconMeta.filter((icon) => {
          const matchName = icon.name.toLowerCase().includes(query.toLowerCase());
          const matchCat = category ? icon.categories.includes(category) : true;
          const matchStyle = style ? icon.style === style : true;
          return matchName && matchCat && matchStyle;
        });
        if (limit) results = results.slice(0, limit);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(results, null, 2)
            }
          ]
        };
      }
    );
  • Precomputed array of metadata for all solid and outline icons from Heroicons, including name, style, and categories; used by the search_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)
      }))
    ];
Behavior2/5

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

With no annotations provided, the description carries full burden but lacks behavioral details. It doesn't mention rate limits, authentication needs, response format, pagination, or error handling. The description only states the basic functionality without operational context.

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 with zero wasted words. It's appropriately sized for this tool's complexity and front-loads the core functionality without unnecessary elaboration.

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?

For a search tool with no annotations and no output schema, the description is minimally adequate. It covers the basic purpose but lacks details about return values, error conditions, and behavioral constraints that would be helpful for an AI 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%, so the schema fully documents all parameters. The description adds minimal value by mentioning 'name or category' search, which aligns with the 'query' parameter but doesn't provide additional semantic context beyond what's in the schema.

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 ('Search for icons') and resource ('from heroicons'), specifying the search scope ('by name or category'). It distinguishes from 'list_all_icons' by implying filtering, but doesn't explicitly differentiate from 'get_icon_usage_examples'.

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?

No guidance on when to use this tool versus siblings is provided. The description implies filtering capabilities but doesn't specify scenarios where search_icons is preferred over list_all_icons or get_icon_usage_examples.

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