Skip to main content
Glama

search

Search the OpenAPI spec. codemode.spec() returns $refs resolved inline.

Types:

// OpenAPI 3.x spec with $refs resolved inline. // The spec object follows the standard OpenAPI 3.x structure.

interface OperationObject { summary?: string; description?: string; operationId?: string; tags?: string[]; parameters?: Array<{ name: string; in: "query" | "header" | "path" | "cookie"; required?: boolean; schema?: unknown; description?: string; }>; requestBody?: { required?: boolean; description?: string; content?: Record<string, { schema?: unknown }>; }; responses?: Record<string, { description?: string; content?: Record<string, { schema?: unknown }>; }>; security?: Array<Record<string, string[]>>; deprecated?: boolean; }

interface PathItem { summary?: string; description?: string; get?: OperationObject; post?: OperationObject; put?: OperationObject; patch?: OperationObject; delete?: OperationObject; head?: OperationObject; options?: OperationObject; trace?: OperationObject; parameters?: OperationObject["parameters"]; }

interface OpenApiSpec { openapi: string; info: { title: string; version: string; description?: string }; paths: Record<string, PathItem>; servers?: Array<{ url: string; description?: string }>; components?: Record<string, unknown>; tags?: Array<{ name: string; description?: string }>; }

declare const codemode: { spec(): Promise; };

Your code must be an async arrow function that returns the result.

Examples:

// List all paths async () => { const spec = await codemode.spec(); return Object.keys(spec.paths); }

// Find endpoints by tag async () => { const spec = await codemode.spec(); const results = []; for (const [path, methods] of Object.entries(spec.paths)) { for (const [method, op] of Object.entries(methods)) { if (op.tags?.some(t => t.toLowerCase() === 'your_tag')) { results.push({ method: method.toUpperCase(), path, summary: op.summary }); } } } return results; }

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "search"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript async arrow function to search the spec

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full disclosure burden. It does add real behavioral detail: `codemode.spec()` returns $refs resolved inline, and the code must be an async arrow function whose return value is the result. However, it says nothing about sandboxing, side effects, execution timeouts, whether the code can reach the network or other tools, or the potential size of the resolved spec — material facts for a code-execution tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and API surface are front-loaded, which is good, but the bulk of the text is verbose TypeScript interface declarations that restate the standard OpenAPI 3.x structure the model already knows. Since there is no output schema, the type of the returned spec has to be conveyed somehow, but the full `OperationObject`/`PathItem` expansion is longer than necessary. The examples earn their place; much of the interface block does not.

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?

For a code-execution tool with one input and no output schema, the definition supplies the injected API, the return convention, the shape of what comes back, and two runnable examples — enough for an agent to write a working script. Missing pieces are runtime semantics: isolation, failure modes when the script throws, and guidance on large results. Those gaps keep it below a 5.

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?

Schema coverage is 100%, so the single `code` parameter is already described, but the description adds substantial meaning beyond it: the exact function form, the injected `codemode` object, the shape of the returned spec, and concrete examples of valid code. This meaningfully compensates for the terse schema field. It stops short of 5 because error/edge behavior (e.g., a non-async or non-returning function) is not specified.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence names a specific verb and resource: "Search the OpenAPI spec," and immediately clarifies the mechanism (code passed to a tool with `codemode.spec()` access). It is distinguishable from a plain query tool because the examples make clear the agent writes an async arrow function rather than supplying search terms. It does not differentiate itself from siblings like `execute` or `docs`, which keeps it from a 5.

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

Usage Guidelines3/5

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

Usage is only implied through the two worked examples (list all paths, find endpoints by tag), which show typical tasks but never state when this tool is preferred over a sibling such as `execute` or `docs`. There are no explicit exclusions or prerequisites beyond the input shape. An agent can infer intent, but the choice between this and sibling code-execution tools is left to guesswork.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.