Skip to main content
Glama

get_template

Retrieve UI component templates for reference when building accessible, framework-agnostic components according to the components.build specification.

Instructions

Get a component template for reference

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
templateYesTemplate name

Implementation Reference

  • Registration of the 'get_template' tool in the getToolDefinitions() array, including name, description, and input schema.
    {
      name: 'get_template',
      description: 'Get a component template for reference',
      inputSchema: {
        type: 'object',
        properties: {
          template: {
            type: 'string',
            description: 'Template name',
            enum: ['button', 'card', 'input', 'basic', 'composable'],
          },
        },
        required: ['template'],
      },
    },
  • The handler function that executes the get_template tool logic: extracts the template name from args, generates the corresponding component template code using imported generators, formats it with description, and returns as ToolResult.
    function handleGetTemplate(args: Record<string, unknown>): ToolResult {
      const template = args.template as string;
    
      let code: string;
      let description: string;
    
      switch (template) {
        case 'button':
          code = generateButtonComponent();
          description = 'A fully accessible button component with variants, sizes, and asChild support.';
          break;
        case 'card':
          code = generateCardComponent();
          description = 'A composable card component with Header, Title, Description, Content, and Footer sub-components.';
          break;
        case 'input':
          code = generateInputComponent();
          description = 'An accessible input component with proper focus states and styling.';
          break;
        case 'composable':
          code = generateComposableComponent({ name: 'Example' });
          description = 'A composable component template with Root, Trigger, and Content pattern using Context.';
          break;
        case 'basic':
        default:
          code = generateBasicComponent({ name: 'Example', hasVariants: true });
          description = 'A basic component template with CVA variants.';
          break;
      }
    
      const text = `# Template: ${template}
    
    ${description}
    
    \`\`\`tsx
    ${code}
    \`\`\`
    `;
    
      return {
        content: [{ type: 'text', text }],
      };
    }
  • Dispatch registration in the executeTool switch statement, routing 'get_template' calls to handleGetTemplate.
    case 'get_template':
      return handleGetTemplate(args);
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 the tool gets a template 'for reference', implying a read-only operation, but doesn't specify if it's safe, if authentication is needed, what the output format is, or any error conditions. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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 unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly. There's no wasted verbiage, and it earns its place by conveying the essential function.

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 lack of annotations and output schema, the description is incomplete for a tool that retrieves data. It doesn't explain what 'for reference' entails, what the return value looks like, or any limitations. With no structured fields to compensate, the description should provide more context about the tool's behavior and output, but it falls short.

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 description doesn't add any parameter details beyond what the input schema provides. With 100% schema description coverage, the schema fully documents the single parameter 'template' with its enum values. The description doesn't explain what a 'component template' is or how the parameter relates to it, so it meets the baseline of 3 without adding extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose as 'Get a component template for reference', which includes a verb ('Get') and resource ('component template'), making it clear what it does. However, it doesn't differentiate from siblings like 'get_quick_reference' or 'get_specification', leaving ambiguity about when to use this specific tool versus others that also retrieve reference materials.

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. With siblings like 'get_quick_reference' and 'get_specification', there's no indication of whether this is for templates only, what context it's suited for, or any prerequisites. It relies entirely on the agent to infer usage from the name and description.

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/getlokiui/components-build-mcp'

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