Skip to main content
Glama

check_cli

Check whether the mockzilla CLI is available on the system or in cache, and present installation options if not found.

Instructions

Check whether the mockzilla CLI is available — either on the system PATH, in the bridge's own cache (~/.cache/mockzilla-mcp/), or via a go run invocation. Call FIRST when the user wants to try mockzilla locally. If nothing resolves, the response carries install_options; suggest install_cli to the user and ask them which method (download / go-install / go-run) they prefer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'check_cli' tool. Checks if mockzilla CLI is available (system PATH, bridge cache, or go-run invocation) and returns {installed: true/false} with appropriate details or install options.
    export async function checkCli() {
      const resolved = await resolveMockzilla();
      if (resolved) {
        return {
          installed: true,
          source: resolved.source,
          version: resolved.version,
          ...(resolved.type === "binary"
            ? { path: resolved.path }
            : { invocation: resolved.invocation }),
        };
      }
    
      const goAvailable = await hasGo();
      return {
        installed: false,
        install_options: buildInstallOptions(goAvailable),
        notes:
          "No mockzilla CLI on PATH or in the bridge cache. Suggest " +
          "`install_cli`; ask the user whether they want to download the " +
          "prebuilt binary, build from source via `go install`, or skip " +
          "install entirely and use `go run`.",
      };
    }
  • lib/tools.js:20-34 (registration)
    Registration of the 'check_cli' tool in the LOCAL_TOOLS registry with description, empty inputSchema, and handler pointing to checkCli function.
    check_cli: {
      description:
        "Check whether the mockzilla CLI is available — either on the " +
        "system PATH, in the bridge's own cache (~/.cache/mockzilla-mcp/), " +
        "or via a `go run` invocation. Call FIRST when the user wants to " +
        "try mockzilla locally. If nothing resolves, the response carries " +
        "`install_options`; suggest `install_cli` to the user and ask them " +
        "which method (download / go-install / go-run) they prefer.",
      inputSchema: {
        type: "object",
        properties: {},
        additionalProperties: false,
      },
      handler: checkCli,
    },
  • Input schema for 'check_cli' — an empty object with no properties since the tool takes no arguments.
    inputSchema: {
      type: "object",
      properties: {},
      additionalProperties: false,
    },
  • Helper function called by checkCli that resolves mockzilla availability (system PATH → bridge cache → go-run invocation).
    export async function resolveMockzilla() {
      try {
        const { stdout } = await exec("mockzilla --version");
        return {
          type: "binary",
          path: "mockzilla",
          version: stdout.trim().replace(/^v/, ""),
          source: "system",
        };
      } catch {
        /* not on PATH */
      }
    
      const config = await readConfig();
      if (config && (config.method === "download" || config.method === "go-install")) {
        try {
          const { stdout } = await exec(
            `${shellEscape(CACHE_BIN_PATH)} --version`,
          );
          return {
            type: "binary",
            path: CACHE_BIN_PATH,
            version: stdout.trim().replace(/^v/, ""),
            source: "cache",
          };
        } catch {
          /* cache binary missing or broken */
        }
      }
    
      if (
        config &&
        config.method === "go-run" &&
        Array.isArray(config.invocation) &&
        (await hasGo())
      ) {
        return {
          type: "go-run",
          invocation: config.invocation,
          version: config.version,
          source: "go-run",
        };
      }
    
      return null;
    }
  • Helper function that builds the install_options array returned by checkCli when CLI is not installed.
    function buildInstallOptions(goAvailable) {
      const options = [
        {
          method: "download",
          recommended: true,
          requires: ["network access to github.com"],
          summary:
            `Pull the prebuilt mockzilla v${MOCKZILLA_VERSION} binary for ` +
            `${process.platform}/${process.arch} into the bridge cache.`,
        },
      ];
      if (goAvailable) {
        options.push({
          method: "go-install",
          requires: ["go on PATH"],
          summary:
            `Compile mockzilla v${MOCKZILLA_VERSION} from source via ` +
            `\`go install\`. Audit-friendly; needs the Go toolchain.`,
        });
        options.push({
          method: "go-run",
          requires: ["go on PATH"],
          summary:
            `Skip install: future serve_locally calls will use ` +
            `\`go run ${MOCKZILLA_MODULE}@v${MOCKZILLA_VERSION}\`. ` +
            `First run compiles into Go's module cache; later runs are instant.`,
        });
      } else {
        for (const method of ["go-install", "go-run"]) {
          options.push({
            method,
            requires: ["go on PATH"],
            available: false,
            summary: "Go is not on PATH; install Go first if you want this method.",
          });
        }
      }
      return options;
    }
Behavior4/5

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

Discloses search paths and response content (install_options), though does not detail whether it executes the CLI or just checks files.

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?

Concise and structured, though slightly verbose with user guidance that could be secondary.

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

Completeness4/5

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

Covers key aspects: inputs (none), actions, and follow-up steps. No output schema, but description implies response structure.

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; baseline 4 applies. Description adds no parameter info but none is needed.

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 tool checks CLI availability across three specific locations, and distinguishes its use case as the first step for local mockzilla attempts.

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

Usage Guidelines5/5

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

Explicitly says 'Call FIRST' and provides follow-up action: if unavailable, suggest install_cli with method options.

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