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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- lib/local.js:227-240 (handler)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, }, - lib/local.js:548-556 (helper)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; } - lib/local.js:22-23 (helper)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"); - lib/local.js:48-52 (helper)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;