Skip to main content
Glama
shadcnspace

Shadcn Space MCP

Get Block Installation Command

getBlockInstall

Returns the official installation command for a Shadcn Space block, enabling automatic addition to your project before customization.

Instructions

Returns the official installation command for a specific Shadcn Space block. Agents can use this to add a block to the project automatically before customizing it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe exact name of the block, e.g., 'hero-01'.

Implementation Reference

  • The handler function for the 'getBlockInstall' tool. It takes a block name, fetches component details via fetchComponentDetails, and returns the installation command 'npx shadcn@latest add @shadcn-space/<name>'.
      async ({ name }) => {
        try {
          const componentDetails = await fetchComponentDetails(name);      
          process.stderr.write(`Fetched ${componentDetails} blocks\n`);
    
          if (!componentDetails || !componentDetails.files?.length) {
            return {
              content: [
                {
                  type: "text",
                  text: `Component "${name}" not found.`,
                },
              ],
              isError: true,
            };
          }
    
          const installCommand = `npx shadcn@latest add @shadcn-space/${name}`;
    
          return {
            content: [
              {
                type: "text",
                text: `Block "${name}" found.
    
    AGENT RULE:
    You MUST install this component using the command below.
    You are NOT allowed to recreate, rewrite, or approximate this component.
    
    Install command:
    ${installCommand}
    `,
              },
            ],
          };
        } catch {
          return {
            content: [
              {
                type: "text",
                text: `Failed to fetch component "${name}"`,
              },
            ],
            isError: true,
          };
        }
      },
    );
  • The input schema for the 'getBlockInstall' tool. It defines a required string input 'name' describing the block name (e.g., 'hero-01').
    {
      title: "Get Block Installation Command",
      description:
        "Returns the official installation command for a specific Shadcn Space block. Agents can use this to add a block to the project automatically before customizing it.",
      inputSchema: z.object({
        name: z
          .string()
          .describe("The exact name of the block, e.g., 'hero-01'."),
      }),
    },
  • src/server.ts:93-95 (registration)
    Registration of the 'getBlockInstall' tool on the MCP server using server.registerTool().
    // Register tools for adding a Block
    server.registerTool(
      "getBlockInstall",
  • Helper function fetchComponentDetails that fetches component details from the registry JSON at shadcnspace.com and finds the component by name.
    export async function fetchComponentDetails(name: string) {
      try {
        const response = await fetch(
          `https://shadcnspace.com/r/registry.json`,
        );
        
        if (!response.ok) {
          throw new Error(
            `Failed to fetch component ${name}: ${response.statusText}`,
          );
        }
    
        const data = await response.json();
    
        const component = data.items.find((item: any) => {
          return item.name === name;
        });
        return component;
    
      } catch (error) {
        console.error(`Error fetching component ${name}:`, error);
        throw error;
      }
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It states the tool is read-only (returns a command) and adds context about adding a block. It does not mention any side effects, permissions, or rate limits. For a simple read operation, this is adequate but not exceptional.

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 zero wasted words. The purpose is front-loaded in the first sentence, and usage context is in the second. Every sentence adds value.

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

Completeness5/5

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

Given the tool's simplicity (1 parameter, no output schema, no annotations, few siblings), the description fully covers what the tool does, when to use it, and what the parameter expects. No critical information is missing.

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 description coverage is 100% for the single parameter 'name', providing an example. The description adds 'for a specific Shadcn Space block' but no further details beyond the schema. Baseline is 3 due to full schema coverage.

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?

The description clearly states it returns the installation command for a block and is used to add a block before customizing. The verb 'Returns' and resource 'installation command' are specific. It distinguishes from siblings such as listBlocks (listing) and listInstalledBlocks (listing installed) by focusing on the command retrieval action.

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

Usage Guidelines4/5

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

The description explicitly states when to use: 'Agents can use this to add a block to the project automatically before customizing it.' This provides clear usage context. However, it does not include when not to use or alternatives, though siblings implicitly cover other actions.

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