Skip to main content
Glama
ymadd

shadcn-ui MCP Server

by ymadd

list_shadcn_components

Retrieve all available shadcn/ui components to explore options for building user interfaces with documented examples and usage details.

Instructions

Get a list of all available shadcn/ui components

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handleListComponents method implements the core logic for the list_shadcn_components tool. It checks cache, fetches component list from https://ui.shadcn.com/docs/components using axios and cheerio, parses links to extract component names and URLs, caches the list, and returns it 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:105-113 (registration)
    Registration of the list_shadcn_components tool in the ListToolsRequestSchema handler, defining name, description, and empty input schema (no parameters required).
    {
      name: "list_shadcn_components",
      description: "Get a list of all available shadcn/ui components",
      inputSchema: {
        type: "object",
        properties: {},
        required: [],
      },
    },
  • Input schema for list_shadcn_components tool, specifying an empty object with no properties or required fields.
    inputSchema: {
      type: "object",
      properties: {},
      required: [],
    },
  • Dispatch case in the CallToolRequestSchema handler that routes calls to list_shadcn_components to the handleListComponents method.
    case "list_shadcn_components":
      return await this.handleListComponents();
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.

Install Server

Other 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/ymadd/shadcn-ui-mcp-server'

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