Skip to main content
Glama

peek_openapi

Summarize an OpenAPI spec to inspect its title, version, endpoints, and paths before serving or deploying. Accepts a file path or public URL.

Instructions

Summarise an OpenAPI spec without serving it. Returns {title, version, openapi_version, endpoint_count, paths}. Pass input as a file path or a public https URL. Use this when the user wants to know what's in a spec before deciding whether to serve or deploy it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYes

Implementation Reference

  • The main handler function for the peek_openapi tool. Accepts an `input` argument (file path or URL), resolves the mockzilla CLI, and runs `mockzilla info <input>` to summarise an OpenAPI spec. Returns JSON with {title, version, openapi_version, endpoint_count, paths}.
    export async function peekOpenapi(args) {
      const input = args.input;
      if (typeof input !== "string" || input.length === 0) {
        throw new Error("`input` must be a non-empty string");
      }
      const resolved = await resolveMockzilla();
      if (!resolved) {
        throw new Error("mockzilla is not installed. Call install_cli first.");
      }
      const [cmd, ...prefix] =
        resolved.type === "binary" ? [resolved.path] : resolved.invocation;
      const cmdline = [cmd, ...prefix, "info", input].map(shellEscape).join(" ");
      try {
        const { stdout } = await exec(cmdline);
        return JSON.parse(stdout);
      } catch (err) {
        throw new Error((err.stderr && err.stderr.trim()) || err.message);
      }
    }
  • lib/tools.js:346-362 (registration)
    Registration of the 'peek_openapi' tool in the LOCAL_TOOLS registry, including its description and input schema.
    peek_openapi: {
      description:
        "Summarise an OpenAPI spec without serving it. Returns " +
        "{title, version, openapi_version, endpoint_count, paths}. " +
        "Pass `input` as a file path or a public https URL. Use this " +
        "when the user wants to know what's in a spec before deciding " +
        "whether to serve or deploy it.",
      inputSchema: {
        type: "object",
        properties: {
          input: { type: "string" },
        },
        required: ["input"],
        additionalProperties: false,
      },
      handler: peekOpenapi,
    },
  • Input schema for peek_openapi: expects an object with a required string property 'input' (file path or URL).
    inputSchema: {
      type: "object",
      properties: {
        input: { type: "string" },
      },
      required: ["input"],
      additionalProperties: false,
    },
  • shellEscape is used by peekOpenapi to safely escape shell arguments when constructing the `mockzilla info <input>` command line.
    export function shellEscape(s) {
      if (process.platform === "win32") {
        // Conservative quote: wrap and double internal quotes.
        return `"${String(s).replace(/"/g, '""')}"`;
      }
      return `'${String(s).replace(/'/g, "'\\''")}'`;
    }
Behavior4/5

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

No annotations provided, but description reveals read-only operation, input types, and that it returns summary not full spec. Could mention side effects, but none exist.

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?

Two sentences, front-loaded with main action and return value, 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 the simple single-parameter tool with no output schema, the description covers all essential information: purpose, input format, and return structure.

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?

Schema has 0% coverage, but description adds critical semantics: input can be file path or public https URL, which fully clarifies the parameter.

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 the tool summarizes an OpenAPI spec without serving it, lists return fields, and contrasts with serve/deploy siblings.

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 tells when to use ('before deciding whether to serve or deploy it'), and implies alternatives (serve_locally, call_endpoint).

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