Skip to main content
Glama

link

Links a local package directory to global node_modules for development, optionally specifying the package name.

Instructions

Symlink a local package for development

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory
packageNoPackage name to link (omit to link current dir globally)

Implementation Reference

  • Handler function for the 'link' tool. Runs 'npm link' (or 'npm link <package>') via child_process in the specified directory.
    async ({ path, package: pkg }) => {
      const args = ["link"];
      if (pkg) args.push(pkg);
      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,
        };
      }
    },
  • Registration and handler for the 'link' tool on the primary server. Defines schema (path required, package optional) and handler logic.
    server.tool(
      "link",
      "Symlink a local package for development",
      {
        path: z.string().describe("Absolute path to the package directory"),
        package: z.string().optional().describe("Package name to link (omit to link current dir globally)"),
      },
      async ({ path, package: pkg }) => {
        const args = ["link"];
        if (pkg) args.push(pkg);
        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,
          };
        }
      },
    );
  • Helper function 'run' that executes npm commands via child_process.execFile, used by the link 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);
    }
  • src/index.ts:1407-1410 (registration)
    Registration of the 'link' tool in the sandbox server (with noop handler, for Smithery Sandbox environment).
    sandbox.tool("link", "Symlink a local package for development", {
      path: z.string().describe("Absolute path to the package directory"),
      package: z.string().optional().describe("Package name to link"),
    }, noop);
Behavior2/5

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

No annotations are provided, so the description must fully disclose behavioral traits. The term 'symlink' implies creating a symbolic link, but the description does not specify whether this operation is destructive, requires specific permissions, or has side effects on the global node_modules. The agent lacks critical context about 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.

Conciseness4/5

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

The description is one short sentence that quickly conveys the core action. It is front-loaded and contains no unnecessary words. However, it could benefit from slightly more detail without becoming verbose.

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 the tool has no output schema and is part of a large set of sibling tools, the description is incomplete. It fails to explain what happens when the tool is invoked (e.g., returns a status, creates a symlink in global modules). The agent lacks information to fully understand the tool's behavior and output.

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?

Both parameters have descriptions in the input schema (100% coverage), so the baseline is 3. The description adds no additional meaning beyond what the schema already provides for 'path' and 'package'. It does not explain usage nuances like when to omit 'package'.

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 uses the specific verb 'symlink' and clearly identifies the resource as 'a local package for development'. It immediately distinguishes itself from sibling tools like 'install' (which downloads packages) or 'publish' (which uploads packages), making the tool's purpose unambiguous.

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?

The description provides no guidance on when to use this tool versus alternatives. For example, it doesn't explain that 'link' is for local development symlinking as opposed to using 'install' for remote dependencies. The agent has no context to decide between this and sibling tools.

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