Skip to main content
Glama
shadcnspace

Shadcn Space MCP

List All Blocks

listBlocks

Retrieves a complete list of Shadcn Space blocks, enabling agents to explore block types before deciding which ones to add or customize.

Instructions

Provides a complete list of all Shadcn Space blocks that can be used in a project. Agents can use this to explore available block types before deciding which ones to add or customize.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:24-56 (registration)
    Registration of the 'listBlocks' tool on the MCP server with input schema (empty object) and handler callback.
    server.registerTool(
      "listBlocks",
      {
        title: "List All Blocks",
        description:
          "Provides a complete list of all Shadcn Space blocks that can be used in a project. Agents can use this to explore available block types before deciding which ones to add or customize.",
        inputSchema: z.object({}),
      },
      async () => {
        try {
          const uiBlocks = await fetchUIBlocks();
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(uiBlocks, null, 2),
              },
            ],
          };
        } catch {
          return {
            content: [
              {
                type: "text",
                text: "Failed to fetch MagicUI Blocks",
              },
            ],
            isError: true,
          };
        }
      },
    );
  • Handler function for 'listBlocks' tool. Calls fetchUIBlocks() and returns the result as formatted JSON text, or an error message on failure.
    async () => {
      try {
        const uiBlocks = await fetchUIBlocks();
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(uiBlocks, null, 2),
            },
          ],
        };
      } catch {
        return {
          content: [
            {
              type: "text",
              text: "Failed to fetch MagicUI Blocks",
            },
          ],
          isError: true,
        };
      }
    },
  • Helper function fetchUIBlocks() that fetches registry.json from shadcnspace.com, filters items with type 'registry:block', and parses them using ComponentSchema.
    export async function fetchUIBlocks() {
      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:block")
          .map((item: any) => {
            try {
              return ComponentSchema.parse({
                name: item.name,
                type: item.type,
                description: item.description,
                title: item.title,
              });
            } catch (parseError) {
              return null;
            }
          });
      } catch (error) {
        return [];
      }
    }
  • ComponentSchema used by fetchUIBlocks() to validate/parse block data (fields: name, title, type, description).
    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
    });
  • dist/server.js:15-42 (registration)
    Compiled (dist) version of the 'listBlocks' tool registration, identical in behavior to src/server.ts.
    server.registerTool("listBlocks", {
        title: "List All Blocks",
        description: "Provides a complete list of all Shadcn Space blocks that can be used in a project. Agents can use this to explore available block types before deciding which ones to add or customize.",
        inputSchema: z.object({}),
    }, async () => {
        try {
            const uiBlocks = await fetchUIBlocks();
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(uiBlocks, null, 2),
                    },
                ],
            };
        }
        catch {
            return {
                content: [
                    {
                        type: "text",
                        text: "Failed to fetch MagicUI Blocks",
                    },
                ],
                isError: true,
            };
        }
    });
Behavior2/5

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

No annotations provided, so description carries full burden. It only states 'complete list' but fails to disclose read-only nature, performance implications, or any side effects.

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 sentences with no wasted words, directly stating purpose and typical usage context.

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?

For a simple listing tool with no output schema, the description adequately covers use case but could mention what fields are returned (e.g., block names/types).

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 exist, so baseline 4 applies. The description adds no param-specific info, but none is needed.

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

Purpose5/5

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

Clearly states the tool lists all Shadcn Space blocks, distinguishing it from siblings like getBlockInstall or searchBlocks by focusing on exploration before addition/customization.

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 exploring available blocks before customizing, but does not explicitly contrast with siblings or state when not to use (e.g., if searching for a specific block, use searchBlocks).

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