Skip to main content
Glama
shadcnspace

Shadcn Space MCP

List Installed Blocks

listInstalledBlocks

List all installed shadcn/ui blocks in your project. Optionally filter by name to identify available blocks for customization or updates.

Instructions

Lists all blocks that are currently installed in the project. Agents can use this to determine which blocks are available for customization or updating, and optionally filter by specific block names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namesNoOptional list of block names to filter the installed blocks.

Implementation Reference

  • src/server.ts:187-231 (registration)
    Tool registration for 'listInstalledBlocks' using server.registerTool with inputSchema and handler.
    server.registerTool(
      "listInstalledBlocks",
      {
        title: "List Installed Blocks",
        description:
          "Lists all blocks that are currently installed in the project. Agents can use this to determine which blocks are available for customization or updating, and optionally filter by specific block names.",
        inputSchema: z.object({
          names: z
            .array(z.string())
            .optional()
            .describe(
              "Optional list of block names to filter the installed blocks.",
            ),
        }),
      },
      async ({ names }) => {
        // If no names provided → return all installed blocks
        const blocks = names?.length
          ? await fetchMultipleComponentDetails(names)
          : await fetchUIBlocks();
    
        const normalized = blocks.map(
          (b: { name: any; title: any; files: any }) => ({
            name: b.name,
            title: b.title,
            files: b.files ?? [],
          }),
        );
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  blocks: normalized,
                },
                null,
                2,
              ),
            },
          ],
        };
      },
    );
  • Handler that fetches installed blocks (filtered by names if provided) and returns normalized results.
    async ({ names }) => {
      // If no names provided → return all installed blocks
      const blocks = names?.length
        ? await fetchMultipleComponentDetails(names)
        : await fetchUIBlocks();
    
      const normalized = blocks.map(
        (b: { name: any; title: any; files: any }) => ({
          name: b.name,
          title: b.title,
          files: b.files ?? [],
        }),
      );
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                blocks: normalized,
              },
              null,
              2,
            ),
          },
        ],
      };
    },
  • Input schema: optional array of block names (z.array(z.string()).optional()).
    inputSchema: z.object({
      names: z
        .array(z.string())
        .optional()
        .describe(
          "Optional list of block names to filter the installed blocks.",
        ),
    }),
  • fetchUIBlocks: Fetches registry.json from shadcnspace.com, filters for 'registry:block' items, parses with 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 [];
      }
    }
  • fetchMultipleComponentDetails: Fetches registry.json and optionally filters by block names, returning name/title/files metadata.
    export async function fetchMultipleComponentDetails(
      nameOrNames?: string | string[],
    ): Promise<BlockMetadata[]> {
      const res = await fetch(
        "https://shadcnspace.com/r/registry.json",
      );
      const registry = await res.json();
      let blocks = registry.items;
    
      if (nameOrNames) {
        const names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];
        blocks = blocks.filter((b: any) => names.includes(b.name));
      }
    
      // Return only metadata + file paths
      return blocks.map((b: any) => ({
        name: b.name,
        title: b.title,
        files: b.files ?? [],
      }));
    }
Behavior3/5

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

No annotations provided, description implies a read operation without side effects, but does not explicitly state safety or constraints. Adequate but not detailed.

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 short sentences covering function, purpose, and optional filter. No redundant information.

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

Completeness3/5

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

Lacks details on output format or pagination, but given it's a list tool with no output schema, description is sufficient for basic use. Could be improved with return structure.

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

Parameters3/5

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

Schema covers the only parameter fully; description adds 'optionally filter' which is already in schema. Minimal added value beyond schema.

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 it lists installed blocks in the project, with ability to filter by name. Distinguishes from siblings like listBlocks (all blocks) and getBlockInstall (single install).

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?

Mentions use case for customization/updating but lacks explicit exclusion or comparison with sibling tools. Agent might need to infer when not to use.

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