get_all_components
Retrieve all UI components from the Magic UI design system via MCP Magic UI, enabling clients and AI assistants to access and utilize available elements for integration and development.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:27-49 (handler)The inline asynchronous handler function that implements the logic for the 'get_all_components' tool. It attempts to return raw registry data from GitHub, falling back to parsed components from ComponentParser if unavailable, formatted as JSON text content.async () => { // Get the raw content of registry.json const rawData = githubService.getRawRegistryData(); // If no data, return processed components as fallback if (!rawData || rawData.length === 0) { const components = componentParser.getAllComponents(); return { content: [{ type: "text", text: JSON.stringify(components, null, 2), }], }; } // Return the raw content of registry.json return { content: [{ type: "text", text: JSON.stringify(rawData, null, 2), }], }; }
- src/server.ts:24-50 (registration)Registration of the 'get_all_components' tool using McpServer.tool(), with no input parameters (empty schema) and the inline handler function.server.tool( "get_all_components", {}, async () => { // Get the raw content of registry.json const rawData = githubService.getRawRegistryData(); // If no data, return processed components as fallback if (!rawData || rawData.length === 0) { const components = componentParser.getAllComponents(); return { content: [{ type: "text", text: JSON.stringify(components, null, 2), }], }; } // Return the raw content of registry.json return { content: [{ type: "text", text: JSON.stringify(rawData, null, 2), }], }; } );
- Helper method in ComponentParser class that returns an array of all loaded components, used as a fallback data source in the tool handler.getAllComponents(): Component[] { return Array.from(this.components.values()); }