Skip to main content
Glama
ceorkm

ReactBits MCP Server

by ceorkm

get_component_demo

Retrieve usage examples and demo code for any ReactBits component to quickly implement animated components in your project.

Instructions

Get usage example and demo code for a ReactBits component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the component

Implementation Reference

  • src/index.ts:91-104 (registration)
    Tool registration for 'get_component_demo' in the tools array, defining its name, description, and inputSchema (requires 'name' string property).
    {
      name: 'get_component_demo',
      description: 'Get usage example and demo code for a ReactBits component',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the component',
          },
        },
        required: ['name'],
      },
    },
  • Handler case for 'get_component_demo' in the CallToolRequestSchema switch statement. Extracts the component name from args, validates it, then calls reactBitsService.getComponentDemo(componentName) and returns the result.
    case 'get_component_demo': {
      const componentName = args?.name as string;
      
      if (!componentName) {
        throw new Error('Component name is required');
      }
    
      const demo = await reactBitsService.getComponentDemo(componentName);
      return {
        content: [
          {
            type: 'text',
            text: demo,
          },
        ],
      };
    }
  • The getComponentDemo method in ReactBitsService class. Calls this.getComponent(componentName) to fetch the component source code, extracts the component name from code using regex, then wraps it in a JSX demo wrapper with a simple usage example.
      async getComponentDemo(componentName: string): Promise<string> {
        const component = await this.getComponent(componentName);
        
        // Extract component name from the code
        const componentNameMatch = component.match(/(?:export\s+default\s+function|const)\s+(\w+)/);
        const extractedName = componentNameMatch ? componentNameMatch[1] : componentName.replace(/\s+/g, '');
        
        // Create a demo wrapper
        return `// Demo for ${componentName}
    import React from 'react';
    
    ${component}
    
    // Usage Example:
    export default function Demo() {
      return (
        <div className="min-h-screen bg-gray-100 p-8">
          <h1 className="text-2xl font-bold mb-4">${componentName} Demo</h1>
          <${extractedName} />
        </div>
      );
    }`;
      }
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It only states what is returned, without disclosing behaviors such as error handling, performance implications, or whether the result is a code snippet or a full file.

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 sentence that is front-loaded with the action and resource. It contains no fluff and is appropriately sized for the tool's simplicity.

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?

Given the tool has only one parameter and no output schema, the description is minimally adequate. However, it lacks behavioral context (e.g., what happens if the component does not exist) and does not describe the nature of the returned demo code (e.g., format, size).

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?

The input schema has one parameter 'name' with a clear description. Schema coverage is 100%, so the description adds no additional meaning beyond what the schema provides. Baseline score of 3 is appropriate.

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 the verb 'Get', the resource 'usage example and demo code', and the domain 'ReactBits component'. It distinguishes from siblings like get_component (which likely returns the component itself) and list categories/components.

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?

The description implies usage when needing an example or demo, but does not provide explicit guidance on when to use or when not to use this tool versus alternatives like get_component or search_components.

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/ceorkm/reactbits-mcp-server'

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