Skip to main content
Glama

compose_components

Combine multiple its-just-ui React components into structured layouts for building complex user interfaces. Specify components and choose vertical, horizontal, or grid arrangements.

Instructions

Create a composition of multiple its-just-ui components

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentsYes
layoutNoLayout for composition

Implementation Reference

  • Core implementation of composing multiple components into a layout container using generateComponent recursively and Tailwind layout classes.
    generateComponent.compose = function (
      components: Array<{
        type: string;
        props?: Record<string, any>;
        children?: string;
      }>,
      layout: string = "vertical",
    ): string {
      const layoutClasses: Record<string, string> = {
        vertical: "flex flex-col gap-4",
        horizontal: "flex flex-row gap-4",
        grid: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",
      };
    
      const componentCode = components
        .map((comp) => generateComponent(comp.type, comp.props, comp.children))
        .join("\n  ");
    
      return `<div className="${layoutClasses[layout] || layoutClasses.vertical}">
      ${componentCode}
    </div>`;
    };
  • Zod schema defining the input parameters for the compose_components tool: components array and optional layout.
    const ComposeComponentsSchema = z.object({
      components: z
        .array(
          z.object({
            type: z.string(),
            props: z.record(z.any()).optional(),
            children: z.string().optional(),
          }),
        )
        .describe("Array of components to compose"),
      layout: z
        .enum(["vertical", "horizontal", "grid"])
        .optional()
        .describe("Layout for composition"),
    });
  • src/index.ts:181-206 (registration)
    Tool registration in the ListTools response, including name, description, and inputSchema.
    {
      name: "compose_components",
      description: "Create a composition of multiple its-just-ui components",
      inputSchema: {
        type: "object",
        properties: {
          components: {
            type: "array",
            items: {
              type: "object",
              properties: {
                type: { type: "string" },
                props: { type: "object" },
                children: { type: "string" },
              },
              required: ["type"],
            },
          },
          layout: {
            type: "string",
            enum: ["vertical", "horizontal", "grid"],
            description: "Layout for composition",
          },
        },
        required: ["components"],
      },
  • MCP CallTool handler that parses arguments using the schema and delegates to generateComponent.compose.
    case "compose_components": {
      const { components, layout } = ComposeComponentsSchema.parse(args);
      const composition = generateComponent.compose(components, layout);
      return {
        content: [
          {
            type: "text",
            text: composition,
          },
        ],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states 'Create a composition,' implying a write operation, but doesn't clarify permissions, side effects, or response format. This is a significant gap for a mutation tool with zero annotation coverage.

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, efficient sentence that directly states the tool's purpose without any fluff or redundancy. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 complexity of creating UI compositions with multiple components, the lack of annotations, no output schema, and incomplete parameter documentation, the description is inadequate. It doesn't explain what the composition entails, how it's used, or what the tool returns, leaving critical gaps for the agent.

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 50%, with the 'layout' parameter documented but 'components' not described. The description mentions 'multiple its-just-ui components,' which loosely relates to the 'components' parameter but adds minimal semantic detail beyond the schema's structure. This meets the baseline for partial coverage.

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 ('Create a composition') and the resource ('multiple its-just-ui components'), making the purpose understandable. However, it doesn't distinguish this tool from siblings like 'create_form' or 'create_responsive_layout', which might also involve UI composition, so it misses full differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name and parameters alone, which is insufficient for effective decision-making.

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