Skip to main content
Glama

ci

Installs npm dependencies cleanly from lockfile, ensuring reproducible builds in CI environments.

Instructions

Clean install dependencies from lockfile (for CI environments)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory

Implementation Reference

  • The tool handler for 'ci'. It receives a 'path' argument and runs 'npm ci' in the specified directory using the 'run' helper function.
    server.tool(
      "ci",
      "Clean install dependencies from lockfile (for CI environments)",
      {
        path: z.string().describe("Absolute path to the package directory"),
      },
      async ({ path }) => {
        const args = ["ci"];
        try {
          const { stdout, stderr } = await run(args, path);
          return { content: [{ type: "text", text: stdout + stderr }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
  • src/index.ts:844-861 (registration)
    The tool 'ci' is registered via server.tool() with the name 'ci', description, Zod schema, and handler.
    server.tool(
      "ci",
      "Clean install dependencies from lockfile (for CI environments)",
      {
        path: z.string().describe("Absolute path to the package directory"),
      },
      async ({ path }) => {
        const args = ["ci"];
        try {
          const { stdout, stderr } = await run(args, path);
          return { content: [{ type: "text", text: stdout + stderr }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
  • The input schema for the 'ci' tool — requires a 'path' (string) describing the absolute path to the package directory.
      path: z.string().describe("Absolute path to the package directory"),
    },
  • The 'run' helper function that executes npm commands (including 'npm ci') via child_process.execFile with timeout, buffer limits, and optional .npmrc token config.
    async function run(
      args: string[],
      cwd?: string,
    ): Promise<{ stdout: string; stderr: string }> {
      const fullArgs = [...args, ...npmrcArgs];
      const opts: { cwd?: string; timeout: number; env: NodeJS.ProcessEnv; maxBuffer: number } = {
        timeout: 120_000,
        maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large outputs
        env: { ...process.env, NO_COLOR: "1" },
      };
      if (cwd) opts.cwd = cwd;
      return exec(NPM, fullArgs, opts);
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the burden. It hints at destructive behavior ('clean install') but does not explicitly state that existing dependencies will be removed or that it is safe for CI.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise, consisting of a single phrase that front-loads the action and context without any wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one well-described parameter, the description provides sufficient context (action, resource, environment). However, it could be more explicit about side effects like removing previous installations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter 'path' is fully described in the schema as 'Absolute path to the package directory'. The description adds no additional meaning beyond this, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'clean install', the resource 'dependencies', and the context 'from lockfile (for CI environments)', making it distinct from sibling tools like 'install' or 'update'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage in CI environments but does not explicitly state when to use this tool versus alternatives (e.g., 'install'), nor does it provide when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/mikusnuz/npm-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server