Skip to main content
Glama
stephenlumban

NTV Scaffolding MCP Server

generate_ntv_component_file

Generate complete TypeScript component files for Angular applications using NTV components, including optional CSS styles and test templates.

Instructions

Generates a complete TypeScript component file that uses an NTV component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesComponent name (e.g., 'Button', 'Input')
filenameNoOutput filename without extension (e.g., 'my-button'). Default: component name in kebab-case
selectorNoAngular component selector (e.g., 'app-my-button')
includeStylesNoInclude CSS file template. Default: true
includeTestsNoInclude Jest/Jasmine test template. Default: true

Implementation Reference

  • The main execute handler that orchestrates generation of TS, HTML, CSS, and spec files for the NTV component.
    execute: async (args: Record<string, unknown>) => {
      const componentName = args.component as string;
      const filename = (args.filename as string) || toKebabCase(componentName);
      const selector = (args.selector as string) || `app-${filename}`;
      const includeStyles = args.includeStyles !== false;
      const includeTests = args.includeTests !== false;
    
      const component = COMPONENTS_DB.find(
        (c) => c.name.toLowerCase() === componentName.toLowerCase()
      );
    
      if (!component) {
        throw new Error(`Component '${componentName}' not found`);
      }
    
      const files: Record<string, string> = {};
    
      // Generate TypeScript file
      files[`${filename}.ts`] = generateTypeScriptFile(component, selector);
    
      // Generate HTML template
      files[`${filename}.html`] = generateTemplateFile(component, selector);
    
      // Generate CSS file
      if (includeStyles) {
        files[`${filename}.css`] = generateCSSFile();
      }
    
      // Generate test file
      if (includeTests) {
        files[`${filename}.spec.ts`] = generateTestFile(component, selector, filename);
      }
    
      return {
        component: componentName,
        files,
        componentClass: toPascalCase(filename),
        selector,
        note: "All files are ready to be created in your Angular project",
      };
    },
  • Input schema defining parameters for component name, filename, selector, and optional flags for styles and tests.
    inputSchema: {
      type: "object",
      properties: {
        component: {
          type: "string",
          description: "Component name (e.g., 'Button', 'Input')",
        },
        filename: {
          type: "string",
          description:
            "Output filename without extension (e.g., 'my-button'). Default: component name in kebab-case",
        },
        selector: {
          type: "string",
          description: "Angular component selector (e.g., 'app-my-button')",
        },
        includeStyles: {
          type: "boolean",
          description: "Include CSS file template. Default: true",
        },
        includeTests: {
          type: "boolean",
          description: "Include Jest/Jasmine test template. Default: true",
        },
      },
      required: ["component"],
    },
  • Registration of the tool by including it in the componentTools array exported for use by the MCP server.
    export const componentTools: MCPTool[] = [
      generateComponentTool,
      getComponentDocTool,
      listComponentsTool,
      generateComponentUsageTool,
      getComponentPropsToolDefinition,
      generateTemplateCodeTool,
      getComponentExamplesTool,
      getComponentUsagePatternTool,
    ];
  • Helper function generating the Angular TypeScript component file template.
    function generateTypeScriptFile(component: any, selector: string): string {
      const className = toPascalCase(selector.replace("app-", ""));
      return `import { Component, signal } from '@angular/core';
    import { CommonModule } from '@angular/common';
    import { ${component.name}${component.configInterface ? `, ${component.configInterface}` : ""} } from '@ntv-scaffolding/component-pantry';
    
    @Component({
      selector: '${selector}',
      standalone: true,
      imports: [CommonModule, ${component.name}],
      templateUrl: './${selector.replace("app-", "")}.html',
      styleUrls: ['./${selector.replace("app-", "")}.css'],
    })
    export class ${className} {
      // Component logic here
      
      onAction() {
        console.log('Action triggered');
      }
    }`;
    }
  • Utility functions for converting strings between kebab-case and PascalCase, used for filename and class name generation.
    function toKebabCase(str: string): string {
      return str
        .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2")
        .toLowerCase();
    }
    
    function toPascalCase(str: string): string {
      return str
        .split("-")
        .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
        .join("");
    }
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 'generates' a file, implying a write operation, but doesn't specify where the file is saved (e.g., local filesystem, cloud storage), permissions required, error handling, or output format. For a file-generation tool with zero annotation coverage, this leaves critical behavioral traits unaddressed.

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 front-loads the core purpose without unnecessary details. It avoids redundancy and wastes no words, making it easy to parse quickly. This is an excellent example of conciseness in tool descriptions.

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's complexity (file generation with 5 parameters) and lack of annotations or output schema, the description is minimally adequate. It states what the tool does but misses contextual details like the generated file's structure, dependencies on NTV libraries, or example outputs. For a tool with no output schema, more information on return values or success indicators would improve completeness.

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 100% description coverage, documenting all 5 parameters clearly (e.g., 'component' as the component name, 'filename' as output filename). The description adds no additional parameter semantics beyond what the schema provides, such as examples of NTV components or constraints on naming conventions. With high schema coverage, the baseline score of 3 is appropriate.

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 tool's purpose: 'Generates a complete TypeScript component file that uses an NTV component.' It specifies the verb ('generates'), resource ('TypeScript component file'), and technology context ('NTV component'), making it easy to understand. However, it doesn't explicitly differentiate from siblings like 'generate_ntv_template_code' or 'generate_ntv_component_usage,' which might have overlapping purposes.

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 'generate_ntv_template_code' and 'generate_ntv_component_usage,' it's unclear if this tool is for full file generation, partial code snippets, or other contexts. There's no mention of prerequisites, dependencies, or scenarios where this tool is preferred over others.

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