Skip to main content
Glama
Tai-DT
by Tai-DT

get_shadcn_component

Retrieve shadcn/ui component source code and usage examples for React or Svelte frameworks to accelerate UI development with ready-to-use components.

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")
includeDemoNoInclude usage examples
frameworkNoFramework to get component forreact

Implementation Reference

  • The main handler function that implements the logic for the 'get_shadcn_component' tool, returning a formatted response with component details.
    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, including its name, description, and input schema.
    {
      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/index.ts:433-434 (registration)
    In the tool call dispatcher switch statement, maps the tool name to the getComponent handler function.
    case 'get_shadcn_component':
      return await getComponent(args as unknown as ShadcnComponentRequest);
  • TypeScript interface defining the input parameters for the get_shadcn_component tool.
    export interface ShadcnComponentRequest {
      componentName: string;
      framework?: 'react' | 'svelte';
      variant?: string;
      includeDemo?: boolean;
      customization?: Record<string, any>;
    }

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