fuzzy_search_categories
Find Lucide Icons categories using fuzzy search by entering a query term and specifying the number of results to display. Simplifies locating relevant icon categories efficiently.
Instructions
Fuzzy Search for icon categories by category name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Max results to return | |
| query | Yes | Search term for category name |
Implementation Reference
- src/utils.ts:148-153 (handler)The inline async handler function for the fuzzy_search_categories tool. It creates a Fuse.js searcher on the categories data, performs fuzzy search with the query, applies the optional limit to results, and returns a formatted text response.async ({ query, limit }) => { const fuse = SearchService.createFuseSearch(categories, ["name"]); let results = fuse.search(query); results = SearchService.applyLimit(results, limit); return createTextResponse(results); }
- src/utils.ts:144-147 (schema)Zod schema defining the input parameters: required 'query' string and optional 'limit' number (validated via shared schema).{ query: z.string().describe("Search term for category name"), limit: searchSchemas.categoryLimit.describe("Max results to return") },
- src/utils.ts:141-154 (registration)Registration of the 'fuzzy_search_categories' tool on the MCP server, including name, description, schema, and handler.server.tool( "fuzzy_search_categories", "Fuzzy Search for icon categories by category name", { query: z.string().describe("Search term for category name"), limit: searchSchemas.categoryLimit.describe("Max results to return") }, async ({ query, limit }) => { const fuse = SearchService.createFuseSearch(categories, ["name"]); let results = fuse.search(query); results = SearchService.applyLimit(results, limit); return createTextResponse(results); } );
- src/utils.ts:55-60 (helper)Static helper method in SearchService that initializes a Fuse.js instance for fuzzy searching on the given data and keys, case-insensitive.static createFuseSearch<T>(data: T[], keys: string[]) { return new Fuse(data, { keys, isCaseSensitive: false }); }
- src/utils.ts:14-21 (helper)Utility function to create a standard MCP text response by stringifying the data as pretty JSON.const createTextResponse = (data: any) => ({ content: [ { type: "text" as const, text: JSON.stringify(data, null, 2) } ] });