Skip to main content
Glama

clear_mock_endpoints

Delete all API mocks and stop the managed server to reset testing environment.

Instructions

Wipe ALL mocks created via mock_endpoint and stop the managed server. Equivalent to rm -rf ~/.cache/mockzilla-mcp/mocks plus stop_locally. Use when the user wants to start fresh. Does not touch the mockzilla CLI binary or other bridge state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for clear_mock_endpoints. Kills the managed server, deletes the MOCKS_ROOT directory recursively, and resets lastManagedPort.
    export async function clearMockEndpoints() {
      // Kill the managed server first so it's not holding file handles
      // when we delete its tree out from under it.
      const wasRunning = await killManaged();
      await rm(MOCKS_ROOT, { recursive: true, force: true });
      lastManagedPort = null;
      return {
        cleared: true,
        server_was_running: wasRunning,
        notes:
          "All mocks deleted. Managed server stopped. Next mock_endpoint " +
          "call will create a fresh server.",
      };
    }
  • lib/tools.js:221-233 (registration)
    Registration of 'clear_mock_endpoints' in the LOCAL_TOOLS registry, with description, empty inputSchema, and handler reference to clearMockEndpoints.
    clear_mock_endpoints: {
      description:
        "Wipe ALL mocks created via `mock_endpoint` and stop the managed " +
        "server. Equivalent to `rm -rf ~/.cache/mockzilla-mcp/mocks` " +
        "plus `stop_locally`. Use when the user wants to start fresh. " +
        "Does not touch the mockzilla CLI binary or other bridge state.",
      inputSchema: {
        type: "object",
        properties: {},
        additionalProperties: false,
      },
      handler: clearMockEndpoints,
    },
  • killManaged helper function: kills the managed server process (SIGTERM) and removes it from the localServers map.
    async function killManaged() {
      if (localServers.size === 0) return false;
      const [pid, entry] = localServers.entries().next().value;
      if (entry.kind !== "managed") return false;
      entry.child.kill("SIGTERM");
      await new Promise((resolve) => entry.child.once("exit", resolve));
      localServers.delete(pid);
      return true;
    }
  • MOCKS_ROOT constant: the directory path (~/.cache/mockzilla-mcp/mocks) that gets deleted by clearMockEndpoints.
    const MOCKS_ROOT = path.join(homedir(), ".cache", "mockzilla-mcp", "mocks");
    const MOCKS_STATIC_DIR = path.join(MOCKS_ROOT, "static");
  • lastManagedPort state variable: tracks the port of the managed server; reset to null by clearMockEndpoints.
    const MANAGED_DEFAULT_PORT = parseInt(
      process.env.MOCKZILLA_MANAGED_PORT || "2200",
      10,
    );
    let lastManagedPort = null;
Behavior5/5

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

With no annotations, the description fully bears the burden. It describes the destructive nature (wiping all mocks and stopping server), provides an equivalent command (`rm -rf ~/.cache/mockzilla-mcp/mocks` plus `stop_locally`), and explicitly states what it does NOT affect ('Does not touch the mockzilla CLI binary or other bridge state'), offering full transparency.

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, well-structured paragraph. It front-loads the primary action, includes a functional equivalent, and adds clarifying statements. Every sentence serves a purpose, with no unnecessary words.

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 no output schema and no annotations, the description provides complete context: what the tool does, how it relates to siblings (`mock_endpoint`, `stop_locally`), its effects, and its limitations. Nothing essential is missing for correct invocation.

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?

The tool has zero parameters, so schema coverage is 100%. The description adds meaning by explaining the effect, but since no parameters exist, it cannot add parameter-level detail. Baseline 4 is appropriate.

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's action: 'Wipe ALL mocks created via `mock_endpoint` and stop the managed server.' It uses a specific verb ('Wipe') and resource ('ALL mocks'), and distinguishes itself from sibling tools like `mock_endpoint` (which creates) and `stop_locally` (only stops server).

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 explicitly says 'Use when the user wants to start fresh,' providing a clear usage context. It does not explicitly state when not to use, but the context is sufficient to infer that this is for complete cleanup; alternatives like `stop_locally` exist for partial actions.

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