Skip to main content
Glama

list_mock_endpoints

Retrieve all mocked API endpoints with method, service, path, and file. Access the mock server URL and interactive UI for inspection.

Instructions

List all endpoints currently mocked via mock_endpoint. Returns {endpoints: [{method, service, path, file}], server_url, ui_url}. If a managed server is running, ui_url is the mockzilla UI (opens in a browser, shows endpoints grouped by service plus request inspection). Suggest the UI to the user when they want to explore beyond what the agent can show in chat.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the tool logic. Reads the MOCKS_STATIC_DIR, walks service directories using collectEndpoints, and returns endpoints array along with server_url and ui_url.
    export async function listMockEndpoints() {
      const endpoints = [];
      const rootStat = await stat(MOCKS_STATIC_DIR).catch(() => null);
      if (!rootStat || !rootStat.isDirectory()) {
        return {
          endpoints: [],
          count: 0,
          server_url: managedServerUrl(),
          ui_url: managedServerUiUrl(),
          notes:
            "No mocks have been created yet. Use mock_endpoint to add one.",
        };
      }
    
      const services = await readdir(MOCKS_STATIC_DIR, { withFileTypes: true });
      for (const svc of services) {
        if (!svc.isDirectory()) continue;
        await collectEndpoints(
          path.join(MOCKS_STATIC_DIR, svc.name),
          svc.name,
          [],
          endpoints,
        );
      }
    
      const serverUrl = managedServerUrl();
      return {
        endpoints,
        count: endpoints.length,
        server_url: serverUrl,
        ui_url: managedServerUiUrl(),
        notes: serverUrl
          ? `Open ${managedServerUiUrl()} for the mockzilla UI ` +
            `(grouped by service, request inspection, response config).`
          : "No managed server is currently running. The next mock_endpoint " +
            "call will start one.",
      };
    }
  • Helper function that recursively walks the static mock directory structure to collect endpoint entries (method, service, path, file) into the output array.
    async function collectEndpoints(dir, service, pathSegs, out) {
      const entries = await readdir(dir, { withFileTypes: true }).catch(() => []);
      for (const e of entries) {
        if (!e.isDirectory()) continue;
        const childDir = path.join(dir, e.name);
        if (ALLOWED_METHODS.has(e.name.toUpperCase())) {
          const childEntries = await readdir(childDir, {
            withFileTypes: true,
          }).catch(() => []);
          const idx = childEntries.find(
            (ce) => ce.isFile() && ce.name.startsWith("index."),
          );
          if (idx) {
            out.push({
              method: e.name.toUpperCase(),
              service,
              path: "/" + [service, ...pathSegs].join("/"),
              file: path.join(childDir, idx.name),
            });
          }
        } else {
          await collectEndpoints(childDir, service, [...pathSegs, e.name], out);
        }
      }
    }
  • Helper functions managedServerUrl() and managedServerUiUrl() that retrieve the URL and UI URL of the currently running managed server.
    function managedServerUrl() {
      if (localServers.size === 0) return null;
      const [, entry] = localServers.entries().next().value;
      return entry.kind === "managed" ? entry.url : null;
    }
    
    function managedServerUiUrl() {
      const url = managedServerUrl();
      return url ? url.replace(/\/$/, "") + "/" : null;
    }
  • lib/tools.js:205-219 (registration)
    Registration entry for list_mock_endpoints in the LOCAL_TOOLS registry, containing description, inputSchema (empty object), and handler reference to listMockEndpoints.
    list_mock_endpoints: {
      description:
        "List all endpoints currently mocked via `mock_endpoint`. Returns " +
        "{endpoints: [{method, service, path, file}], server_url, ui_url}. " +
        "If a managed server is running, `ui_url` is the mockzilla UI " +
        "(opens in a browser, shows endpoints grouped by service plus " +
        "request inspection). Suggest the UI to the user when they want " +
        "to explore beyond what the agent can show in chat.",
      inputSchema: {
        type: "object",
        properties: {},
        additionalProperties: false,
      },
      handler: listMockEndpoints,
    },
  • lib/tools.js:8-16 (registration)
    Import statement importing listMockEndpoints from ./local.js into the tools registry.
    import {
      callEndpoint,
      clearMockEndpoints,
      listMockEndpoints,
      mockEndpoint,
      peekOpenapi,
      serveLocally,
      stopLocally,
    } from "./local.js";
Behavior4/5

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

Describes the return format and UI behavior when server is running; despite no annotations, it sufficiently discloses read-only behavior and UI side effect.

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?

Single sentence with return format and usage suggestion; no filler.

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?

Fully covers the tool's purpose, return structure, and contextual usage advice despite lacking an output schema.

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?

Zero parameters, baseline 4; no additional parameter info 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?

Clearly states it lists all endpoints mocked via `mock_endpoint`, distinguishing it from sibling tools like `mock_endpoint` (create) and `clear_mock_endpoints` (delete).

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?

Provides explicit guidance to suggest the UI when the user wants to explore beyond chat, implying this tool is for basic listing while the UI offers richer interaction.

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