search_components
Find React Native components in Reacticx library by searching names, descriptions, and categories to identify suitable UI elements for your project.
Instructions
Search Reacticx components by keyword. Searches component names, descriptions, and categories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query (e.g. 'carousel', 'animation', 'slider', 'loader') |
Implementation Reference
- src/registry.ts:771-780 (handler)Core searchComponents handler function that filters COMPONENT_REGISTRY based on query against name, slug, description, and category fields (case-insensitive)export function searchComponents(query: string): ComponentInfo[] { const q = query.toLowerCase(); return COMPONENT_REGISTRY.filter( (c) => c.name.toLowerCase().includes(q) || c.slug.toLowerCase().includes(q) || c.description.toLowerCase().includes(q) || c.category.toLowerCase().includes(q) ); }
- src/index.ts:148-186 (registration)MCP tool registration for 'search_components' with Zod schema for query parameter, handling results formatting and empty resultsserver.tool( "search_components", "Search Reacticx components by keyword. Searches component names, descriptions, and categories.", { query: z .string() .describe( "Search query (e.g. 'carousel', 'animation', 'slider', 'loader')" ), }, async ({ query }) => { const results = searchComponents(query); if (results.length === 0) { return { content: [ { type: "text" as const, text: `No components found matching "${query}". Try a different keyword.`, }, ], }; } let output = `# Search Results for "${query}" (${results.length} matches)\n\n`; for (const comp of results) { const deps = comp.dependencies.length > 0 ? `\n Dependencies: ${comp.dependencies.join(", ")}` : ""; output += `- **${comp.name}** (\`${comp.slug}\`) [${comp.category}]\n ${comp.description}${deps}\n Install: \`bunx --bun reacticx add ${comp.slug}\`\n\n`; } return { content: [{ type: "text" as const, text: output }], }; } );
- src/registry.ts:1-7 (schema)ComponentInfo interface defining the type structure for component data returned by searchComponentsexport interface ComponentInfo { name: string; slug: string; category: string; description: string; dependencies: string[]; }
- src/index.ts:152-157 (schema)Zod schema validation for the query parameter of search_components toolquery: z .string() .describe( "Search query (e.g. 'carousel', 'animation', 'slider', 'loader')" ), },