Skip to main content
Glama

ng_add

Add npm packages to an Angular workspace using the 'ng add' command. Specify the package name, app root path, and optional settings to integrate dependencies efficiently.

Instructions

Run 'ng add' to add a package to the Angular workspace

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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 ng add
packageYesThe npm package to add (e.g., @angular/material)

Implementation Reference

  • Specific handler logic for the 'ng_add' tool within the switch statement in handleToolCall. Prepares the 'npx ng add' command with the package name and any options.
    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;
  • Defines the tool's name, description, and input schema requiring 'package' and 'appRoot' parameters.
    { 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"], }, },
  • Registers the request handler for listing tools, providing the tool definitions including 'ng_add'.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
  • Registers the request handler for calling tools, which invokes handleToolCall to execute 'ng_add'.
    server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name, request.params.arguments ?? {}, server) );
  • src/index.ts:22-23 (registration)
    Instantiates the tool definitions array containing 'ng_add' by calling createToolDefinitions().
    // Create tool definitions const TOOLS = createToolDefinitions();

Other Tools

Related 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