Skip to main content
Glama
Leee62
by Leee62

get_icons_by_desc_and_prefix

Retrieve SVG icons from Iconify API using descriptive keywords and prefix filters, enabling designers and developers to find UI icons programmatically instead of manual website searches.

Instructions

get icons by desc and prefix (LIKE AS ant-design)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descYesdesc of icon, only English
prefixNoicon prefix, default env.PREFIX

Implementation Reference

  • The inline asynchronous handler function for the MCP tool. It receives desc and optional prefix, calls the searchIconsByPrefixAndDesc helper, handles null response with error message, otherwise maps icon names to SVG names by splitting on ':', stringifies the array as JSON, and returns it wrapped in MCP content format.
    async ({ desc, prefix = process.env.PREFIX as string }) => {
      const res: { icons: string[] } | null = await searchIconsByPrefixAndDesc(
        prefix,
        desc
      );
    
      if (!res) {
        return {
          content: [
            {
              type: "text",
              text: "Failed to Get Icon Collection",
            },
          ],
        };
      }
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              res.icons.map((iconName) => {
                const [_, svgName] = iconName.split(":");
                return svgName;
              })
            ),
          },
        ],
      };
    }
  • Zod schema defining the input parameters for the tool: 'desc' as required string (English description), 'prefix' as optional string (defaults to env.PREFIX).
    {
      desc: z.string().describe("desc of icon, only English"),
      prefix: z.string().optional().describe("icon prefix, default env.PREFIX"),
    },
  • src/index.ts:49-87 (registration)
    MCP tool registration via server.tool() call, specifying the tool name, description, input schema, and handler function.
    server.tool(
      "get_icons_by_desc_and_prefix",
      "get icons by desc and prefix (LIKE AS ant-design)",
      {
        desc: z.string().describe("desc of icon, only English"),
        prefix: z.string().optional().describe("icon prefix, default env.PREFIX"),
      },
      async ({ desc, prefix = process.env.PREFIX as string }) => {
        const res: { icons: string[] } | null = await searchIconsByPrefixAndDesc(
          prefix,
          desc
        );
    
        if (!res) {
          return {
            content: [
              {
                type: "text",
                text: "Failed to Get Icon Collection",
              },
            ],
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                res.icons.map((iconName) => {
                  const [_, svgName] = iconName.split(":");
                  return svgName;
                })
              ),
            },
          ],
        };
      }
    );
  • Supporting utility function that queries the Iconify API search endpoint (`https://api.iconify.design/search?query=${desc}&prefix=${prefix}`), returns parsed JSON response typed as T or null on failure.
    /** get icon collection by prefix And desc (LIKE AS ant-design) */
    export async function searchIconsByPrefixAndDesc<T>(
      prefix: string,
      desc: string
    ): Promise<T | null> {
      try {
        const res = await fetch(
          `https://api.iconify.design/search?query=${desc}&prefix=${prefix}`,
          {
            method: "GET",
          }
        );
    
        if (!res.ok) {
          throw new Error(`HTTP error! status: ${res.status}`);
        }
        return (await res.json()) as T;
      } catch (error) {
        console.error("Error making request:", error);
        return null;
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions filtering by 'desc and prefix' but lacks behavioral details: it doesn't specify if this is a read-only search, how results are returned (e.g., list, pagination), error handling, or any constraints like rate limits or authentication needs. The vague '(LIKE AS ant-design)' adds confusion rather than clarity.

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

Conciseness2/5

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

The description is brief but inefficient: it repeats the tool name, uses unclear phrasing '(LIKE AS ant-design)', and lacks front-loaded clarity. It could be more structured, e.g., specifying the action and resource upfront. While short, it doesn't earn its place with useful information.

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 no annotations, no output schema, and a vague description, this is incomplete for a search tool. It doesn't explain what 'icons' are, how results are structured, or any operational context. Sibling tools hint at an icon system, but the description fails to integrate this, leaving significant gaps for 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%, so the schema already documents both parameters ('desc' as English description, 'prefix' with a default). The description adds minimal value by naming the parameters but doesn't explain their interaction, format examples, or search behavior (e.g., partial matches). Baseline 3 is appropriate as the schema handles most semantics.

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

Purpose3/5

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

The description states the tool 'get icons by desc and prefix' which indicates a retrieval action with filtering criteria. However, it's vague about what 'icons' refers to (e.g., UI icons, image files) and the parenthetical '(LIKE AS ant-design)' is unclear—it might hint at a design system example but doesn't specify the resource domain or differentiate from sibling tools like 'get_icon_detail_by_prefix_and_name' or 'get_icon_repos'.

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 explicit guidance on when to use this tool versus alternatives. The description mentions 'desc and prefix' but doesn't clarify scenarios (e.g., searching by description vs. by name/repo), prerequisites, or exclusions. Sibling tools suggest related icon operations, but no comparison or context is provided.

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/Leee62/pickapicon-mcp'

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