ng_update
Update Angular packages and run migrations with 'ng update'. Specify packages, manage versions, handle peer dependencies, and enable source control commits in Angular projects.
Instructions
Run 'ng update' to update Angular packages and run migrations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| allowDirty | No | Allow updating when the repository contains modified or untracked files. | |
| 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'. | |
| createCommits | No | Create source control commits for updates and migrations. | |
| force | No | Ignore peer dependency version mismatches. | |
| from | No | Version from which to migrate from (only with migrate-only and single package). | |
| migrateOnly | No | Only perform a migration, do not update the installed version. | |
| name | No | The name of the migration to run (only with migrate-only and single package). | |
| next | No | Use the prerelease version, including beta and RCs. | |
| packages | Yes | ||
| to | No | Version up to which to apply migrations (only with migrate-only and single package). | |
| verbose | No | Display additional details about internal operations during execution. |
Implementation Reference
- src/tools.ts:146-224 (schema)Defines the tool 'ng_update' including its name, description, and detailed input schema for parameters such as packages, appRoot, and various ng update options.{ name: "ng_update", description: "Run 'ng update' to update Angular packages and run migrations.", inputSchema: { type: "object", properties: { packages: { oneOf: [ { type: "string", description: "The name of the package to update (e.g., @angular/core)", }, { type: "array", items: { type: "string" }, description: "The names of packages to update.", }, ], }, 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'.", }, next: { type: "boolean", description: "Use the prerelease version, including beta and RCs.", default: false, }, force: { type: "boolean", description: "Ignore peer dependency version mismatches.", default: false, }, allowDirty: { type: "boolean", description: "Allow updating when the repository contains modified or untracked files.", default: false, }, createCommits: { type: "boolean", description: "Create source control commits for updates and migrations.", default: false, }, from: { type: "string", description: "Version from which to migrate from (only with migrate-only and single package).", }, to: { type: "string", description: "Version up to which to apply migrations (only with migrate-only and single package).", }, migrateOnly: { type: "boolean", description: "Only perform a migration, do not update the installed version.", default: false, }, name: { type: "string", description: "The name of the migration to run (only with migrate-only and single package).", }, verbose: { type: "boolean", description: "Display additional details about internal operations during execution.", default: false, }, }, required: ["packages", "appRoot"], }, },
- src/requestHandler.ts:10-13 (registration)Registers the list tools handler which includes the 'ng_update' tool in the returned tools list from createToolDefinitions().// List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
- src/index.ts:22-26 (registration)Calls createToolDefinitions() to include 'ng_update' tool definition and passes it to setupRequestHandlers for registration on the MCP server.// Create tool definitions const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);
- src/toolHandler.ts:9-73 (handler)The generic handleToolCall function processes tool calls via switch on name. 'ng_update' falls to default case returning 'Unknown tool' error, indicating no specific handler implementation exists.try { let command = ""; let commandArgs: string[] = []; let cwd = args.appRoot || process.cwd(); switch (name) { 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; } 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; } 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; } case "ng_run": { command = "npx"; commandArgs = ["ng", "run", args.target]; if (args.options) { for (const [key, value] of Object.entries(args.options)) { commandArgs.push(`--${key}`, String(value)); } } break; } default: return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true, }; } const output = await runCommand(command, commandArgs, cwd); return { content: [{ type: "text", text: output }], isError: false, }; } catch (error) {