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 } ] }; } );

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