Skip to main content
Glama

repo

Retrieve the repository URL of an npm package by specifying its package name.

Instructions

Get the repository URL for a package

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageYesPackage name

Implementation Reference

  • The 'repo' tool handler that executes 'npm repo <package> --no-browser' to get the repository URL for a package.
    // ── npm repo ──
    server.tool(
      "repo",
      "Get the repository URL for a package",
      {
        package: z.string().describe("Package name"),
      },
      async ({ package: pkg }) => {
        const args = ["repo", pkg, "--no-browser"];
        try {
          const { stdout, stderr } = await run(args);
          return { content: [{ type: "text", text: (stdout + stderr).trim() }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );
  • Input schema for the 'repo' tool: requires a 'package' string parameter describing the package name.
    {
      package: z.string().describe("Package name"),
    },
  • src/index.ts:619-638 (registration)
    Registration of the 'repo' tool via server.tool(...) on the MCP server instance.
    // ── npm repo ──
    server.tool(
      "repo",
      "Get the repository URL for a package",
      {
        package: z.string().describe("Package name"),
      },
      async ({ package: pkg }) => {
        const args = ["repo", pkg, "--no-browser"];
        try {
          const { stdout, stderr } = await run(args);
          return { content: [{ type: "text", text: (stdout + stderr).trim() }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );
  • The run() helper function that executes npm commands via child_process.execFile, used by the 'repo' 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?

No annotations provided, and the description does not disclose behavior beyond the basic function. It does not mention error handling (e.g., package not found), return format, or any side effects.

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 a single sentence of 7 words, perfectly concise with no wasted text.

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

Completeness3/5

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

Given the simple tool (1 parameter, no output schema), the description is minimally adequate but lacks details about expected return value, error cases, or assumptions (e.g., package must exist in registry).

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% for the single parameter, but the description adds no meaning beyond the schema's 'Package name'. Baseline 3 applies; no additional value.

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 action ('Get'), the object ('repository URL'), and the target ('for a package'). It is a specific verb-resource pair that distinguishes from sibling tools like 'install' or 'publish'.

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. There is no mention of prerequisites, context, or when not to use it.

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