Skip to main content
Glama

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
NameRequiredDescriptionDefault
componentNameYesName of the shadcn/ui component (e.g., "button", "card", "form")
frameworkNoFramework to get component forreact
includeDemoNoInclude usage examples

Implementation Reference

  • 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'] } },
  • 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);

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Tai-DT/mcp-tailwind-gemini'

If you have feedback or need assistance with the MCP directory API, please join our Discord server