ng_new
Create a new Angular workspace with a specified name and directory structure, generating the initial project files and configuration for Angular development.
Instructions
Run 'ng new' to create a new Angular workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the new workspace | |
| directory | No | The directory to create the workspace in | |
| appRoot | No | 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 | No | Additional options for ng new |
Implementation Reference
- src/toolHandler.ts:38-49 (handler)Handler logic for the 'ng_new' tool. Sets up the 'npx ng new' command using the provided name, optionally sets working directory from 'directory' arg, and appends any options as flags.case "ng_new": { command = "npx"; commandArgs = ["ng", "new", args.name]; if (args.directory) { cwd = args.directory; } if (args.options) { for (const [key, value] of Object.entries(args.options)) { commandArgs.push(`--${key}`, String(value)); } } break;
- src/tools.ts:94-121 (schema)Schema definition for the 'ng_new' tool, including input schema with required 'name' and optional 'directory', 'appRoot', 'options'.{ name: "ng_new", description: "Run 'ng new' to create a new Angular workspace", inputSchema: { type: "object", properties: { name: { type: "string", description: "The name of the new workspace", }, directory: { type: "string", description: "The directory to create the workspace in", }, 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 ng new", additionalProperties: { type: "string" }, }, }, required: ["name"], }, },
- src/requestHandler.ts:9-13 (registration)Registration of tool handlers on the MCP server: ListTools returns the list of tools including 'ng_new', CallTool dispatches to handleToolCall based on name.export function setupRequestHandlers(server: Server, tools: Tool[]) { // List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
- src/index.ts:22-26 (registration)Initializes the tool definitions array (including 'ng_new') and sets up the request handlers on the server.// Create tool definitions const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);