Skip to main content
Glama

doctor

Run diagnostics to assess npm environment health, detect configuration issues, and identify missing dependencies or security problems.

Instructions

Run diagnostics to check npm environment health

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual handler for the 'doctor' tool. It runs 'npm doctor' via the run() helper and captures stdout/stderr. Since 'npm doctor' can exit non-zero when checks fail, the catch block returns the error output instead of marking it as an isError.
    // ── npm doctor ──
    server.tool(
      "doctor",
      "Run diagnostics to check npm environment health",
      {},
      async () => {
        try {
          const { stdout, stderr } = await run(["doctor"]);
          return { content: [{ type: "text", text: stdout + stderr }] };
        } catch (e: any) {
          // doctor may exit non-zero if checks fail
          return { content: [{ type: "text", text: e.stdout || e.stderr || e.message }] };
        }
      },
    );
  • src/index.ts:893-906 (registration)
    Registration of the 'doctor' tool on the main server using server.tool() with name 'doctor', description 'Run diagnostics to check npm environment health', and an empty schema object (no input parameters).
    server.tool(
      "doctor",
      "Run diagnostics to check npm environment health",
      {},
      async () => {
        try {
          const { stdout, stderr } = await run(["doctor"]);
          return { content: [{ type: "text", text: stdout + stderr }] };
        } catch (e: any) {
          // doctor may exit non-zero if checks fail
          return { content: [{ type: "text", text: e.stdout || e.stderr || e.message }] };
        }
      },
    );
  • src/index.ts:1389-1389 (registration)
    Sandbox registration of the 'doctor' tool via sandbox.tool(). Uses a noop handler that returns 'sandbox' text, with empty schema (no parameters).
    sandbox.tool("doctor", "Run diagnostics to check npm environment health", {}, noop);
  • The run() helper function used by the doctor handler. It executes the npm CLI via execFile with a 120s timeout and 10MB buffer, passing NO_COLOR=1 env var and optional NPM_TOKEN auth args.
    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);
    }
Behavior2/5

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

With no annotations, the description should disclose behavioral traits. It only says 'check npm environment health' without detailing side effects, permissions, or what exactly happens.

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

Conciseness4/5

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

One short sentence with no wasted words, but could benefit from additional structured details about what diagnostics are performed.

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

Completeness2/5

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

Given no output schema or annotations, the description lacks specifics about checks performed, output format, or read-only nature, leaving gaps for agent understanding.

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

Parameters4/5

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

No parameters in schema; description provides meaning by specifying the tool's purpose beyond the empty schema, which is adequate for a parameterless tool.

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 'Run diagnostics to check npm environment health', using a specific verb and resource that distinguishes it from sibling tools like install, publish, etc.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives, nor when not to use it. Simply states what it does without usage context.

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