list_components
Retrieve all available shadcn/ui v4 components to understand their structure, usage, and installation for streamlined UI development.
Instructions
Get all available shadcn/ui v4 components
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function that fetches available shadcn/ui v4 components using axios and returns a formatted JSON list.export async function handleListComponents() { try { const axios = await getAxiosImplementation(); const components = await axios.getAvailableComponents(); return { content: [{ type: "text", text: JSON.stringify({ components: components.sort(), total: components.length }, null, 2) }] }; } catch (error) { logError('Failed to list components', error); throw new Error(`Failed to list components: ${error instanceof Error ? error.message : String(error)}`); } }
- src/tools/index.ts:17-25 (registration)Registers the list_components tool by mapping it to the handleListComponents handler function.export const toolHandlers = { get_component: handleGetComponent, get_component_demo: handleGetComponentDemo, list_components: handleListComponents, get_component_metadata: handleGetComponentMetadata, get_directory_structure: handleGetDirectoryStructure, get_block: handleGetBlock, list_blocks: handleListBlocks };
- src/tools/index.ts:56-63 (schema)Defines the tool schema including name, description, and empty inputSchema for list_components (no parameters needed).'list_components': { name: 'list_components', description: 'Get all available shadcn/ui v4 components', inputSchema: { type: 'object', properties: {} } },
- Exports the input schema for the tool (empty object).export const schema = {};
- src/server/capabilities.ts:106-112 (schema)MCP capabilities declaration including schema for list_components tool.list_components: { description: "Get all available shadcn/ui v4 components", inputSchema: { type: "object", properties: {}, }, },