Skip to main content
Glama

owner

List, add, or remove owners for an npm package. Requires package name and optional OTP for 2FA.

Instructions

Manage package owners

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform
packageYesPackage name
userNoUsername (required for add/rm)
otpNoOne-time password for 2FA

Implementation Reference

  • The handler function for the 'owner' tool. Builds npm owner arguments (ls/add/rm with optional user and otp), executes via run(), and returns stdout or an error.
      async ({ action, package: pkg, user, otp }) => {
        const args = ["owner", action, pkg];
        if (user && (action === "add" || action === "rm")) args.push(user);
        if (otp) args.push("--otp", otp);
        try {
          const { stdout } = await run(args);
          return { content: [{ type: "text", text: stdout }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );
  • Zod schema defining the input parameters for the 'owner' tool: action (enum ls/add/rm), package (string), optional user (string), and optional otp (string).
    {
      action: z.enum(["ls", "add", "rm"]).describe("Action to perform"),
      package: z.string().describe("Package name"),
      user: z.string().optional().describe("Username (required for add/rm)"),
      otp: z.string().optional().describe("One-time password for 2FA"),
    },
  • src/index.ts:207-230 (registration)
    Registration of the 'owner' tool on the MCP server using server.tool() with its name, description, schema, and handler.
    server.tool(
      "owner",
      "Manage package owners",
      {
        action: z.enum(["ls", "add", "rm"]).describe("Action to perform"),
        package: z.string().describe("Package name"),
        user: z.string().optional().describe("Username (required for add/rm)"),
        otp: z.string().optional().describe("One-time password for 2FA"),
      },
      async ({ action, package: pkg, user, otp }) => {
        const args = ["owner", action, pkg];
        if (user && (action === "add" || action === "rm")) args.push(user);
        if (otp) args.push("--otp", otp);
        try {
          const { stdout } = await run(args);
          return { content: [{ type: "text", text: stdout }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );
  • src/index.ts:1239-1244 (registration)
    Second registration of the 'owner' tool within a sandbox context (sandbox.tool()), using a noop handler for documentation/schema purposes.
    sandbox.tool("owner", "Manage package owners", {
      action: z.enum(["ls", "add", "rm"]).describe("Action to perform"),
      package: z.string().describe("Package name"),
      user: z.string().optional().describe("Username"),
      otp: z.string().optional().describe("One-time password for 2FA"),
    }, noop);
  • The run() helper function that executes npm commands via execFile, used by the owner handler.
    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 must disclose behavior. It only says 'Manage' which implies mutation, but no details on side effects, auth needs, or idempotency. The read-only 'ls' action is not distinguished from destructive 'add/rm'.

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

Conciseness2/5

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

While very concise (3 words), it is under-specified. Lacks front-loading of key details like available actions or required parameters.

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 medium complexity (4 params, no output schema), the description is too brief. It does not explain return values, error handling, or prerequisites like authentication.

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?

Schema coverage is 100% and each parameter has a brief description. The tool description adds no meaning beyond the schema, so baseline 3 is appropriate.

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

Purpose3/5

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

Description says 'Manage package owners', which is a clear verb-resource pair, but is vague and does not differentiate from sibling tools like 'access' or 'deprecate'. The actions (ls, add, rm) are only revealed in the schema.

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 instead of siblings. The description provides no context about prerequisites or appropriate scenarios.

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