Skip to main content
Glama

install_cli

Install the mockzilla CLI using one of three methods: download a prebuilt binary, compile from source with Go install, or use Go run without permanent installation.

Instructions

Install the mockzilla CLI for this user. Three methods — ASK the user which one they want before calling: • download (recommended): fetch the prebuilt binary for this OS/arch from github.com/mockzilla/mockzilla releases (~38MB). Fast, no toolchain needed. • go-install: run go install <module>@v<version> to compile from source. Needs Go on PATH. • go-run: don't install at all — the bridge stores a go run <module>@v<version> invocation. First serve_locally compiles into Go's module cache; later runs are instant. Needs Go. Files land in the bridge's own cache, never on system PATH; blow it away with rm -rf ~/.cache/mockzilla-mcp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodNodownload

Implementation Reference

  • lib/tools.js:36-62 (registration)
    Registration of the 'install_cli' tool in the LOCAL_TOOLS registry, including its description and inputSchema, mapping to the installCli handler.
    install_cli: {
      description:
        "Install the mockzilla CLI for this user. Three methods — ASK the " +
        "user which one they want before calling:\n" +
        "  • download (recommended): fetch the prebuilt binary for this " +
        "OS/arch from github.com/mockzilla/mockzilla releases (~38MB). " +
        "Fast, no toolchain needed.\n" +
        "  • go-install: run `go install <module>@v<version>` to compile " +
        "from source. Needs Go on PATH.\n" +
        "  • go-run: don't install at all — the bridge stores a `go run " +
        "<module>@v<version>` invocation. First serve_locally compiles " +
        "into Go's module cache; later runs are instant. Needs Go.\n" +
        "Files land in the bridge's own cache, never on system PATH; " +
        "blow it away with `rm -rf ~/.cache/mockzilla-mcp`.",
      inputSchema: {
        type: "object",
        properties: {
          method: {
            type: "string",
            enum: ["download", "go-install", "go-run"],
            default: "download",
          },
        },
        additionalProperties: false,
      },
      handler: installCli,
    },
  • Input schema for install_cli: accepts a 'method' string with enum values 'download', 'go-install', 'go-run' (default 'download').
    inputSchema: {
      type: "object",
      properties: {
        method: {
          type: "string",
          enum: ["download", "go-install", "go-run"],
          default: "download",
        },
      },
      additionalProperties: false,
    },
  • The installCli handler function. Dispatches to installViaDownload, installViaGoInstall, or installViaGoRun based on the args.method parameter.
    export async function installCli(args) {
      const method = args.method || "download";
      await mkdir(CACHE_BIN_DIR, { recursive: true });
    
      if (method === "download") return await installViaDownload();
      if (method === "go-install") return await installViaGoInstall();
      if (method === "go-run") return await installViaGoRun();
      throw new Error(`Unknown install method: ${method}`);
    }
  • installViaDownload: downloads the prebuilt mockzilla binary from GitHub releases for the current OS/arch.
    async function installViaDownload() {
      const goos = nodePlatformToGoos(process.platform);
      const goarch = nodeArchToGoarch(process.arch);
      if (!goos || !goarch) {
        throw new Error(
          `No prebuilt binary for ${process.platform}/${process.arch}. ` +
            `Try method: "go-install" or "go-run".`,
        );
      }
      const ext = goos === "windows" ? ".exe" : "";
      const assetName = `mockzilla-v${MOCKZILLA_VERSION}-${goos}-${goarch}${ext}`;
      const url = `https://github.com/mockzilla/mockzilla/releases/download/v${MOCKZILLA_VERSION}/${assetName}`;
    
      const tmpPath = `${CACHE_BIN_PATH}.partial`;
      const res = await fetch(url);
      if (!res.ok) {
        throw new Error(`download failed: ${res.status} ${res.statusText} ${url}`);
      }
      await pipeline(res.body, createWriteStream(tmpPath));
      await chmod(tmpPath, 0o755);
      await rename(tmpPath, CACHE_BIN_PATH);
    
      await writeConfig({ method: "download", version: MOCKZILLA_VERSION });
    
      const { stdout } = await exec(`${shellEscape(CACHE_BIN_PATH)} --version`);
      return {
        method: "download",
        version: stdout.trim().replace(/^v/, ""),
        path: CACHE_BIN_PATH,
        asset: assetName,
      };
    }
  • installViaGoInstall and installViaGoRun: compile from source via 'go install' or configure a 'go run' invocation.
    async function installViaGoInstall() {
      if (!(await hasGo())) {
        throw new Error(
          'Go is not on PATH. Install Go first or use method: "download".',
        );
      }
      const target = `${MOCKZILLA_MODULE}@v${MOCKZILLA_VERSION}`;
      const { stdout: gobinRaw } = await exec("go env GOBIN");
      let gobin = gobinRaw.trim();
      if (!gobin) {
        const { stdout: gopathRaw } = await exec("go env GOPATH");
        gobin = path.join(gopathRaw.trim(), "bin");
      }
      await exec(`go install ${target}`);
      // The package's main is `cmd/server`, so go install names the binary
      // `server`. Copy into our cache as `mockzilla` for resolveMockzilla.
      const compiledPath = path.join(
        gobin,
        process.platform === "win32" ? "server.exe" : "server",
      );
      await exec(`cp ${shellEscape(compiledPath)} ${shellEscape(CACHE_BIN_PATH)}`);
      await chmod(CACHE_BIN_PATH, 0o755);
      await writeConfig({ method: "go-install", version: MOCKZILLA_VERSION });
    
      const { stdout } = await exec(`${shellEscape(CACHE_BIN_PATH)} --version`);
      return {
        method: "go-install",
        version: stdout.trim().replace(/^v/, ""),
        path: CACHE_BIN_PATH,
        source_module: target,
      };
    }
    
    async function installViaGoRun() {
      if (!(await hasGo())) {
        throw new Error(
          'Go is not on PATH. Install Go first or use method: "download".',
        );
      }
      const invocation = ["go", "run", `${MOCKZILLA_MODULE}@v${MOCKZILLA_VERSION}`];
      await writeConfig({
        method: "go-run",
        version: MOCKZILLA_VERSION,
        invocation,
      });
      return {
        method: "go-run",
        version: MOCKZILLA_VERSION,
        invocation,
        notes:
          "Nothing was downloaded. The first serve_locally call will compile " +
          "via Go's module cache (slow first time, instant after).",
      };
    }
Behavior4/5

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

With no annotations, the description fully discloses installation methods, cache location, system PATH impact, and uninstall procedure. It is transparent about where files land and how to clean up, though could mention potential network usage or error scenarios.

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 concise (4 sentences) and front-loads the purpose and a key instruction. It could be improved with bullet points for the methods, but remains clear and avoids redundancy.

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

Completeness5/5

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

Given the tool's simplicity (1 parameter, no output schema), the description is complete: it explains each method, side effects (cache location, not on PATH), and how to uninstall. No critical gaps remain.

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

Parameters5/5

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

The description adds substantial meaning beyond the schema: it explains each enum value (download: prebuilt binary, go-install: compile from source, go-run: use go run without install), including size, speed, and dependencies. This is essential given 0% schema description coverage.

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 'Install the mockzilla CLI for this user' and details three specific methods, distinguishing the tool from siblings like check_cli and serve_locally.

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

Usage Guidelines4/5

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

The description instructs the agent to ask the user which method to use and lists prerequisites for each method (e.g., Go needed for go-install/go-run). It does not explicitly exclude scenarios but provides sufficient context for decision-making.

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/mockzilla/mockzilla-mcp'

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