get_shadcn_component
Retrieve shadcn/ui component source code and usage examples by specifying the component name, framework, and optional demo inclusion to streamline UI development.
Instructions
Get shadcn/ui component source code and usage examples
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| componentName | Yes | Name of the shadcn/ui component (e.g., "button", "card", "form") | |
| framework | No | Framework to get component for | react |
| includeDemo | No | Include usage examples |
Implementation Reference
- src/utils/tool-functions.ts:111-121 (handler)The primary handler function for executing the 'get_shadcn_component' tool. It receives the arguments and returns a MCP-formatted response with placeholder content describing the shadcn component retrieval.// shadcn Integration export async function getComponent(args: ShadcnComponentRequest) { return { content: [ { type: 'text', text: `Retrieved ${args.componentName} component\nFramework: ${args.framework || 'react'}\nDemo included: ${args.includeDemo || false}` } ] }; }
- src/index.ts:99-123 (registration)Registers the 'get_shadcn_component' tool in the TOOLS array, providing name, description, and input schema for MCP protocol.{ name: 'get_shadcn_component', description: 'Get shadcn/ui component source code and usage examples', inputSchema: { type: 'object', properties: { componentName: { type: 'string', description: 'Name of the shadcn/ui component (e.g., "button", "card", "form")' }, includeDemo: { type: 'boolean', default: true, description: 'Include usage examples' }, framework: { type: 'string', enum: ['react', 'svelte'], default: 'react', description: 'Framework to get component for' } }, required: ['componentName'] } },
- src/types.ts:103-109 (schema)TypeScript interface defining the expected input shape for the get_shadcn_component tool handler, used for type casting.export interface ShadcnComponentRequest { componentName: string; framework?: 'react' | 'svelte'; variant?: string; includeDemo?: boolean; customization?: Record<string, any>; }
- src/index.ts:433-434 (registration)Switch case in the CallToolRequestSchema handler that routes 'get_shadcn_component' calls to the getComponent implementation.case 'get_shadcn_component': return await getComponent(args as unknown as ShadcnComponentRequest);