Skip to main content
Glama

ng_update

Update Angular packages and run migrations to maintain project compatibility and apply framework changes.

Instructions

Run 'ng update' to update Angular packages and run migrations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packagesYes
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'.
nextNoUse the prerelease version, including beta and RCs.
forceNoIgnore peer dependency version mismatches.
allowDirtyNoAllow updating when the repository contains modified or untracked files.
createCommitsNoCreate source control commits for updates and migrations.
fromNoVersion from which to migrate from (only with migrate-only and single package).
toNoVersion up to which to apply migrations (only with migrate-only and single package).
migrateOnlyNoOnly perform a migration, do not update the installed version.
nameNoThe name of the migration to run (only with migrate-only and single package).
verboseNoDisplay additional details about internal operations during execution.

Implementation Reference

  • Defines the input schema, description, and parameters for the 'ng_update' tool.
    { 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"], }, },
  • Registers the list tools handler, exposing the 'ng_update' tool schema in the tools list.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
  • Registers the call tool handler, which dispatches 'ng_update' calls to handleToolCall based on tool name.
    // Call tool handler server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, server) );
  • Generic handler for tool calls. Dispatches via switch on tool name to construct and run 'npx ng ...' commands. 'ng_update' has no specific case and returns an 'Unknown tool' error.
    export async function handleToolCall( name: string, args: any, server: any ): Promise<CallToolResult> { 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) { return { content: [ { type: "text", text: error instanceof Error ? error.message : String(error), }, ], isError: true, }; } }
Install Server

Other Tools

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