Skip to main content
Glama

ng_generate

Generate Angular components, services, and other artifacts using Angular CLI schematics to accelerate development workflow.

Instructions

Run 'ng generate' to create a new Angular artifact (component, service, etc.)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schematicYesThe schematic to generate (e.g., component, service)
nameYesThe name of the artifact to generate
pathNoThe path where the artifact should be created, relative to the appRoot (do not include the app folder itself). For example, if the full path is 'webui/src/app/modules/alerts' and appRoot is 'webui', then path should be 'src/app/modules/alerts'.src/app
appRootYesThe absolute path to the first folder in the 'path' property. For example, if 'path' is 'webui/src/app/modules/alerts', then 'appRoot' should be the absolute path to 'webui'.
optionsNoAdditional options for the schematic

Implementation Reference

  • Specific implementation of the 'ng_generate' tool handler: constructs the 'npx ng generate' command arguments from input parameters (schematic, name, path, options).
    case "ng_generate": { command = "npx"; commandArgs = ["ng", "generate", args.schematic, args.name]; if (args.path) { commandArgs.push("--path", args.path); } if (args.options) { for (const [key, value] of Object.entries(args.options)) { commandArgs.push(`--${key}`, String(value)); } } break; }
  • Input schema, description, and definition for the 'ng_generate' tool.
    { name: "ng_generate", description: "Run 'ng generate' to create a new Angular artifact (component, service, etc.)", inputSchema: { type: "object", properties: { schematic: { type: "string", description: "The schematic to generate (e.g., component, service)", }, name: { type: "string", description: "The name of the artifact to generate", }, path: { type: "string", description: "The path where the artifact should be created, relative to the appRoot (do not include the app folder itself). For example, if the full path is 'webui/src/app/modules/alerts' and appRoot is 'webui', then path should be 'src/app/modules/alerts'.", default: "src/app", }, appRoot: { type: "string", description: "The absolute path to the first folder in the 'path' property. For example, if 'path' is 'webui/src/app/modules/alerts', then 'appRoot' should be the absolute path to 'webui'.", }, options: { type: "object", description: "Additional options for the schematic", properties: { defaults: { type: "boolean", description: "Disable interactive input prompts for options with a default.", default: false, }, dryRun: { type: "boolean", description: "Run through and report activity without writing out results.", default: false, }, force: { type: "boolean", description: "Force overwriting of existing files.", default: false, }, help: { type: "boolean", description: "Shows a help message for this command in the console.", default: false, }, interactive: { type: "boolean", description: "Enable interactive input prompts.", default: true, }, }, additionalProperties: { type: "string" }, }, }, required: ["schematic", "name", "appRoot"], }, },
  • src/index.ts:23-26 (registration)
    Registers the tools including 'ng_generate' by calling createToolDefinitions() and setting up handlers on the MCP server.
    const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);
  • Registers handler for listing available tools, exposing 'ng_generate' schema to clients.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
  • Registers generic call tool handler that dispatches 'ng_generate' calls to handleToolCall based on name.
    // Call tool handler server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, server) );

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/talzach/mcp-angular-cli'

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