ng_add
Add packages to an Angular workspace to extend functionality, such as including UI libraries like @angular/material or other npm dependencies.
Instructions
Run 'ng add' to add a package to the Angular workspace
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| package | Yes | The npm package to add (e.g., @angular/material) | |
| appRoot | Yes | 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 add |
Implementation Reference
- src/toolHandler.ts:28-36 (handler)Handler implementation for the 'ng_add' tool. It constructs the command 'npx ng add <package>' with any provided options and sets the working directory to appRoot if specified.case "ng_add": { command = "npx"; commandArgs = ["ng", "add", args.package]; if (args.options) { for (const [key, value] of Object.entries(args.options)) { commandArgs.push(`--${key}`, String(value)); } } break;
- src/tools.ts:70-93 (schema)Input schema definition for the 'ng_add' tool, specifying required parameters 'package' and 'appRoot', and optional 'options'.{ name: "ng_add", description: "Run 'ng add' to add a package to the Angular workspace", inputSchema: { type: "object", properties: { package: { type: "string", description: "The npm package to add (e.g., @angular/material)", }, 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 add", additionalProperties: { type: "string" }, }, }, required: ["package", "appRoot"], }, },