search_icons
Find and retrieve icons from Lucide by name or category using partial matching, with optional filters and result limits for precise searches.
Instructions
Search for icons from lucide by name or category using partial matching
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | category to filter by (optional) | |
| limit | No | Max results to return | |
| query | Yes | Search term for icon name |
Implementation Reference
- src/utils.ts:97-106 (handler)Handler function for the 'search_icons' tool that performs partial matching on icon names, optionally filters by category, applies a limit, and returns a formatted text response with the results.async ({ query, category, limit }) => { let results = SearchService.filterIconsByName(iconMetadata, query); if (category) { results = SearchService.filterIconsByCategory(results, category); } results = SearchService.applyLimit(results, limit); return createTextResponse(results); }
- src/utils.ts:89-96 (schema)Zod input schema defining parameters for the 'search_icons' tool: query (required string), category (optional string), limit (optional number with constraints).{ query: z.string().describe("Search term for icon name"), category: z .string() .optional() .describe("category to filter by (optional)"), limit: searchSchemas.iconLimit.describe("Max results to return") },
- src/utils.ts:86-107 (registration)Registration of the 'search_icons' tool using server.tool(), including name, description, input schema, and handler function.server.tool( "search_icons", "Search for icons from lucide by name or category using partial matching", { query: z.string().describe("Search term for icon name"), category: z .string() .optional() .describe("category to filter by (optional)"), limit: searchSchemas.iconLimit.describe("Max results to return") }, async ({ query, category, limit }) => { let results = SearchService.filterIconsByName(iconMetadata, query); if (category) { results = SearchService.filterIconsByCategory(results, category); } results = SearchService.applyLimit(results, limit); return createTextResponse(results); } );
- src/utils.ts:35-39 (helper)SearchService helper method for filtering icons by partial name match (case-insensitive). Used in the search_icons handler.static filterIconsByName(icons: typeof iconMetadata, name: string) { return icons.filter((icon) => icon.name.toLowerCase().includes(name.toLowerCase()) ); }
- src/utils.ts:41-47 (helper)SearchService helper method for filtering icons by partial category match (case-insensitive). Used conditionally in the search_icons handler.static filterIconsByCategory(icons: typeof iconMetadata, category: string) { return icons.filter((icon) => icon.categories.some((cat) => cat.toLowerCase().includes(category.toLowerCase()) ) ); }