Skip to main content
Glama
stephenlumban

NTV Scaffolding MCP Server

generate_ntv_template_code

Generate HTML template code for NTV Angular components with custom variants, sizes, and properties to build consistent UI elements.

Instructions

Generates HTML template code for an NTV component with optional custom configuration

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesComponent name (e.g., 'Button', 'Input')
variantNoVisual variant (e.g., 'primary', 'secondary' for Button)
sizeNoComponent size (e.g., 'sm', 'md', 'lg')
contentNoContent/text to display inside component
additionalPropsNoAdditional properties as key-value pairs (e.g., {disabled: true})
useConfigPatternNoUse the config object pattern (recommended for multiple props). Default: true

Implementation Reference

  • The main handler function that processes input arguments, retrieves component data from COMPONENTS_DB, generates HTML template code using either config pattern or individual props, and returns the template along with import and decorator info.
      execute: async (args: Record<string, unknown>) => {
        const componentName = args.component as string;
        const variant = args.variant as string | undefined;
        const size = args.size as string | undefined;
        const content = args.content as string | undefined;
        const additionalProps = args.additionalProps as Record<string, unknown> | undefined;
        const useConfigPattern = args.useConfigPattern !== false;
    
        const component = COMPONENTS_DB.find(
          (c) => c.name.toLowerCase() === componentName.toLowerCase()
        );
    
        if (!component) {
          throw new Error(`Component '${componentName}' not found`);
        }
    
        let template = "";
    
        if (useConfigPattern && component.configInterface) {
          // Generate config pattern template
          const configProps: Record<string, unknown> = {};
          if (variant) configProps.variant = variant;
          if (size) configProps.size = size;
          if (additionalProps) {
            Object.assign(configProps, additionalProps);
          }
    
          template = `<${component.selector} [config]="${JSON.stringify(configProps).replace(/"/g, "'")}">\n  ${content || component.description}\n</${component.selector}>`;
        } else {
          // Generate individual props template
          let props = "";
          if (variant) props += ` variant="${variant}"`;
          if (size) props += ` size="${size}"`;
    
          if (additionalProps) {
            for (const [key, value] of Object.entries(additionalProps)) {
              if (typeof value === "string") {
                props += ` ${key}="${value}"`;
              } else if (typeof value === "boolean") {
                props += ` [${key}]="${value}"`;
              } else {
                props += ` [${key}]='${JSON.stringify(value)}'`;
              }
            }
          }
    
          template = `<${component.selector}${props}>\n  ${content || component.description}\n</${component.selector}>`;
        }
    
        return {
          component: componentName,
          template,
          imports: `import { ${component.name} } from '@ntv-scaffolding/component-pantry';`,
          componentDecorator: {
            selector: `app-example`,
            standalone: true,
            imports: `[${component.name}]`,
          },
        };
      },
    };
  • Defines the input schema for the tool, specifying properties like component, variant, size, content, additionalProps, and useConfigPattern, with 'component' as required.
    inputSchema: {
      type: "object",
      properties: {
        component: {
          type: "string",
          description: "Component name (e.g., 'Button', 'Input')",
        },
        variant: {
          type: "string",
          description: "Visual variant (e.g., 'primary', 'secondary' for Button)",
        },
        size: {
          type: "string",
          description: "Component size (e.g., 'sm', 'md', 'lg')",
        },
        content: {
          type: "string",
          description: "Content/text to display inside component",
        },
        additionalProps: {
          type: "object",
          description:
            "Additional properties as key-value pairs (e.g., {disabled: true})",
        },
        useConfigPattern: {
          type: "boolean",
          description:
            "Use the config object pattern (recommended for multiple props). Default: true",
        },
      },
      required: ["component"],
    },
  • Registers the generateTemplateCodeTool as part of the componentTools array, making it available as an MCP tool.
    export const componentTools: MCPTool[] = [
      generateComponentTool,
      getComponentDocTool,
      listComponentsTool,
      generateComponentUsageTool,
      getComponentPropsToolDefinition,
      generateTemplateCodeTool,
      getComponentExamplesTool,
      getComponentUsagePatternTool,
    ];
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it 'generates' code without disclosing behavioral traits like whether it overwrites existing files, requires specific permissions, or has rate limits. It mentions 'optional custom configuration' but doesn't explain what that entails beyond the schema parameters, leaving gaps in understanding the tool's operation.

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 and waste, though it could be slightly more structured by explicitly separating purpose from guidance. Every word earns its place, making it appropriately concise for the tool's complexity.

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 no annotations and no output schema, the description is minimally adequate for a code-generation tool with rich schema coverage. It covers the basic purpose but lacks details on behavioral context, output format, or error handling. The schema compensates for parameters, but overall completeness is limited to the bare essentials.

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 6 parameters. The description adds minimal value beyond this, mentioning 'optional custom configuration' which loosely maps to parameters like 'additionalProps' and 'useConfigPattern', but doesn't provide additional meaning or examples. 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 ('Generates') and resource ('HTML template code for an NTV component'), specifying it's for template code rather than full component files or documentation. It distinguishes from siblings like 'generate_ntv_component_file' by focusing on templates, though it doesn't explicitly contrast with 'generate_ntv_component_usage' which might be similar.

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 mentions 'optional custom configuration' but provides no guidance on when to use this tool versus alternatives like 'generate_ntv_component_file' for full files or 'get_ntv_component_usage' for usage examples. There's no explicit when-to-use or when-not-to-use context, leaving the agent to guess based on 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/stephenlumban/component-mcp'

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