Skip to main content
Glama
totodev999

shadcn-ui MCP Server

by totodev999

list_shadcn_components

Retrieve a comprehensive list of all available shadcn/ui components to explore and reference for UI development projects.

Instructions

Get a list of all available shadcn/ui components

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for 'list_shadcn_components' tool. Scrapes shadcn/ui docs/components page to extract list of components using cheerio, caches the result, and returns as JSON text content.
    private async handleListComponents() {
      try {
        if (!this.componentsListCache) {
          // Fetch the list of components
          const response = await this.axiosInstance.get(
            `${this.SHADCN_DOCS_URL}/docs/components`
          );
          const $ = cheerio.load(response.data);
    
          const components: ComponentInfo[] = [];
    
          // Extract component links
          $('a').each((_, element) => {
            const link = $(element);
            const url = link.attr('href');
    
            if (url && url.startsWith('/docs/components/')) {
              const name = url.split('/').pop() || '';
    
              components.push({
                name,
                description: '', // Will be populated when fetching details
                url: `${this.SHADCN_DOCS_URL}${url}`,
              });
            }
          });
    
          this.componentsListCache = components;
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(this.componentsListCache, null, 2),
            },
          ],
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `Failed to fetch shadcn/ui components: ${error.message}`
          );
        }
        throw error;
      }
    }
  • src/index.ts:108-116 (registration)
    Registration of the 'list_shadcn_components' tool in the ListToolsRequestSchema handler, including name, description, and empty input schema.
    {
      name: 'list_shadcn_components',
      description: 'Get a list of all available shadcn/ui components',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • Input schema for the 'list_shadcn_components' tool: empty object with no properties or requirements.
    inputSchema: {
      type: 'object',
      properties: {},
      required: [],
    },
  • Dispatch case in CallToolRequestSchema handler that routes to the list_shadcn_components implementation.
    case 'list_shadcn_components':
      return await this.handleListComponents();
    case 'get_component_details':

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets a list' but doesn't describe what the list contains (e.g., names, metadata), how it's formatted, or any limitations (e.g., pagination, rate limits). For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without any wasted words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and no output schema, the description is incomplete for a tool that likely returns a list of components. It doesn't explain what the output includes (e.g., component names, descriptions, categories) or any behavioral traits. For a tool with no structured data to rely on, the description should provide more context about the return values and usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the schema description coverage is 100% (as there are no parameters to describe). The description doesn't need to add parameter information, so it meets the baseline expectation. No additional value is required beyond stating the tool's purpose.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('list of all available shadcn/ui components'). It distinguishes itself from siblings by focusing on listing all components rather than getting details, examples, or searching. However, it doesn't explicitly mention how it differs from 'search_components' in terms of scope or filtering.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus its siblings. It doesn't mention alternatives like 'search_components' for filtered results or 'get_component_details' for specific information. There's no context about prerequisites, timing, or exclusions for usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.