Skip to main content
Glama

generate_component

Create React components using its-just-ui with custom props, styling, and content to build user interface elements.

Instructions

Generate an its-just-ui component with specified props and styling

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesName of the its-just-ui component
propsNoProps to pass to the component
childrenNoChildren content for the component
classNameNoAdditional Tailwind CSS classes

Implementation Reference

  • Core handler function that generates JSX code for the specified its-just-ui component using props, children, and className. Fetches component from registry, validates props, formats them, and constructs the JSX string.
    export function generateComponent(
      componentName: string,
      props?: Record<string, any>,
      children?: string,
      className?: string,
    ): string {
      const component = componentRegistry.getComponent(componentName);
    
      if (!component) {
        throw new Error(`Component "${componentName}" not found in registry`);
      }
    
      const sanitizedProps = validateProps(props);
      const propsString = formatProps(sanitizedProps, className);
      const childrenContent = children || "";
    
      if (childrenContent) {
        return `<${componentName}${propsString}>\n  ${childrenContent}\n</${componentName}>`;
      } else {
        return `<${componentName}${propsString} />`;
      }
    }
  • Zod schema defining the input validation for the generate_component tool, including component name, optional props, children, and className.
    const GenerateComponentSchema = z.object({
      component: z
        .string()
        .describe("Name of the its-just-ui component to generate"),
      props: z
        .record(z.any())
        .optional()
        .describe("Props to pass to the component"),
      children: z
        .string()
        .optional()
        .describe("Children content for the component"),
      className: z.string().optional().describe("Additional Tailwind CSS classes"),
    });
  • src/index.ts:132-157 (registration)
    Registration of the generate_component tool in the list_tools response, including name, description, and input schema.
      name: "generate_component",
      description:
        "Generate an its-just-ui component with specified props and styling",
      inputSchema: {
        type: "object",
        properties: {
          component: {
            type: "string",
            description: "Name of the its-just-ui component",
          },
          props: {
            type: "object",
            description: "Props to pass to the component",
          },
          children: {
            type: "string",
            description: "Children content for the component",
          },
          className: {
            type: "string",
            description: "Additional Tailwind CSS classes",
          },
        },
        required: ["component"],
      },
    },
  • MCP CallToolRequest handler case for generate_component: parses input with schema and invokes the generateComponent function to produce the output.
    case "generate_component": {
      const { component, props, children, className } =
        GenerateComponentSchema.parse(args);
      const code = generateComponent(component, props, children, className);
      return {
        content: [
          {
            type: "text",
            text: code,
          },
        ],
      };
    }
Behavior2/5

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

With no annotations, the description carries full burden but lacks behavioral details. It implies a creation/mutation action ('generate'), but does not disclose permissions, side effects, rate limits, or output format. This is inadequate for a tool with potential mutative behavior and no output schema, leaving the agent uncertain about consequences and results.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. It avoids redundancy, though it could be slightly more structured by explicitly mentioning key parameters. Overall, it is appropriately concise with no wasted words.

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

Completeness2/5

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

Given the tool's complexity (4 parameters, nested objects, no output schema) and lack of annotations, the description is incomplete. It fails to explain behavioral aspects like mutability, output expectations, or integration with sibling tools, leaving significant gaps for the agent to operate effectively in this UI component context.

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%, so the schema fully documents all 4 parameters. The description adds minimal value beyond the schema, only vaguely referencing 'props and styling' which map to 'props' and 'className' parameters without additional semantics. Baseline 3 is appropriate as the schema does the heavy lifting.

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?

The description clearly states the action ('generate') and target resource ('its-just-ui component'), specifying it creates a component with props and styling. It distinguishes from siblings like 'list_components' (read-only) and 'compose_components' (likely combines multiple), but could be more explicit about differentiation from 'create_form' or 'create_responsive_layout' which may involve similar generation.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives is provided. It does not mention prerequisites, such as needing component names from 'list_components' or 'get_component_docs', nor does it specify contexts like UI building versus theming, leaving the agent to infer usage from sibling tool names alone.

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/its-just-ui/its-just-mcp'

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