Skip to main content
Glama
shadcnspace

Shadcn Space MCP

List All Components

listComponents

List all Shadcn Space components for agents to discover and select when building pages or sections within a project.

Instructions

Provides a full list of Shadcn Space components. Agents can use this to discover components to build pages or sections within a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:59-91 (registration)
    Registration of the 'listComponents' tool on the MCP server. It calls fetchUIComponents() and returns the result as JSON text.
    server.registerTool(
      "listComponents",
      {
        title: "List All Components",
        description:
          "Provides a full list of Shadcn Space components. Agents can use this to discover components to build pages or sections within a project.",
        inputSchema: z.object({}),
      },
      async () => {
        try {
          const uiComponents = await fetchUIComponents();
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(uiComponents, null, 2),
              },
            ],
          };
        } catch {
          return {
            content: [
              {
                type: "text",
                text: "Failed to fetch MagicUI components",
              },
            ],
            isError: true,
          };
        }
      },
    );
  • Handler function for the 'listComponents' tool. Calls fetchUIComponents() and returns the JSON-stringified result, with error handling returning a failure message.
    async () => {
      try {
        const uiComponents = await fetchUIComponents();
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(uiComponents, null, 2),
            },
          ],
        };
      } catch {
        return {
          content: [
            {
              type: "text",
              text: "Failed to fetch MagicUI components",
            },
          ],
          isError: true,
        };
      }
    },
  • Input schema and metadata definitions for the 'listComponents' tool (title, description, empty input schema).
    {
      title: "List All Components",
      description:
        "Provides a full list of Shadcn Space components. Agents can use this to discover components to build pages or sections within a project.",
      inputSchema: z.object({}),
    },
  • The fetchUIComponents() helper function that fetches from the Shadcn Space registry API, filters by 'registry:component' type, and parses each item with ComponentSchema.
    export async function fetchUIComponents() {
      try {
        const response = await fetch(
          "https://shadcnspace.com/r/registry.json",
        );
    
        if (!response.ok) {
          throw new Error(
            `Failed to fetch registry.json: ${response.statusText} (Status: ${response.status})`,
          );
        }
        const data = await response.json();
    
        return data.items
          .filter((item: any) => item.type === "registry:component")
          .map((item: any) => {
            try {
              return ComponentSchema.parse({
                name: item.name,
                type: item.type,
                description: item.description,
              });
            } catch (parseError) {
              return null;
            }
          });
      } catch (error) {
        return [];
      }
    }
  • ComponentSchema Zod schema used by fetchUIComponents() to validate/parse each component item.
    const ComponentSchema = z.object({
      name: z.string(),
      title: z.string().optional(), // Only optional because of interactive-hover-button
      type: z.string(),
      description: z.string().optional(), // Only optional because of interactive-hover-button
    });
Behavior3/5

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

Discloses it provides a 'full list', indicating a read-only operation. No annotations provided, so description covers basic behavior but lacks details on auth, rate limits, or return specifics.

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?

Two concise sentences front-loading the purpose. No redundant words.

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

Completeness4/5

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

Adequate for a simple list tool with no parameters or output schema. Could mention return format (e.g., component names/details) but not critical.

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?

No parameters, so baseline 4 applies. Description adds no param info but schema coverage is complete; no additional meaning needed.

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?

Clearly states verb (list) and resource (components). Differentiates by focusing on 'components' rather than 'blocks', but does not explicitly distinguish from siblings like listBlocks.

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

Usage Guidelines3/5

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

Implies usage for discovering components to build pages/sections, but lacks explicit when-not-to-use or alternative tool mentions.

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/shadcnspace/shadcnspace-mcp'

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