Skip to main content
Glama

generate_ntv_component_usage

Generate complete component usage code with TypeScript class and template for NTV Scaffolding Angular components, providing basic, advanced, or full-form examples.

Instructions

Generates complete component usage code with TypeScript component class and template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYesComponent name (e.g., 'Button', 'Input')
usageTypeNoType of usage example: basic, advanced, or full-form
componentNameNoCustom component name for the example (default: ExampleComponent)

Implementation Reference

  • The main execute handler that processes input arguments, retrieves the specified component from COMPONENTS_DB, determines the usage type, generates the appropriate usage example code, and returns it.
    execute: async (args: Record<string, unknown>) => { const componentName = args.component as string; const usageType = (args.usageType as string) || "basic"; const customComponentName = (args.componentName as string) || "ExampleComponent"; const component = COMPONENTS_DB.find( (c) => c.name.toLowerCase() === componentName.toLowerCase() ); if (!component) { throw new Error(`Component '${componentName}' not found`); } const usageExamples = generateUsageExample(component, usageType, customComponentName); return usageExamples; },
  • Input schema defining the tool's parameters: component (required string), optional usageType (enum: basic/advanced/full-form), and optional componentName.
    inputSchema: { type: "object", properties: { component: { type: "string", description: "Component name (e.g., 'Button', 'Input')", }, usageType: { type: "string", enum: ["basic", "advanced", "full-form"], description: "Type of usage example: basic, advanced, or full-form", }, componentName: { type: "string", description: "Custom component name for the example (default: ExampleComponent)", }, }, required: ["component"], },
  • The tool is registered (as generateComponentUsageTool) in the exported componentTools array used by the main MCP server.
    export const componentTools: MCPTool[] = [ generateComponentTool, getComponentDocTool, listComponentsTool, generateComponentUsageTool, getComponentPropsToolDefinition, generateTemplateCodeTool, getComponentExamplesTool, getComponentUsagePatternTool, ];
  • Core helper function that dispatches to specific usage generators (basic, advanced, full-form) based on the usageType.
    function generateUsageExample( component: Component, usageType: string, customComponentName: string ): Record<string, unknown> { const basePath = `app/${customComponentName.toLowerCase()}`; if (usageType === "basic") { return generateBasicUsage(component, customComponentName); } else if (usageType === "advanced") { return generateAdvancedUsage(component, customComponentName); } else if (usageType === "full-form") { return generateFullFormUsage(component, customComponentName); } return { error: "Unknown usage type" }; }

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