Code Mode MCP tools from OpenAPI specs. Two tools (search + execute) replace hundreds of individual MCP tools.
Both tools accept arbitrary JavaScript code as input, making schema validation impossible. The 'search' tool has a reasonable description (~180 chars) explaining its purpose and output types, but the 'execute' tool description is similarly detailed. However, neither tool has a proper input schema, they only declare a single 'code' parameter of type string with minimal constraint. The tools expose a dangerous pattern: LLMs can inject arbitrary code execution. No error handling guidance, no output schema documentation, and no security boundaries. Tool names are generic ('search', 'execute') rather than API-specific (e.g., 'search_openapi_spec', 'execute_api_request'). This is a code-execution sandbox, not a traditional tool interface.
Execute API calls by writing JavaScript code. First use the 'search' tool to find the right endpoints. Available in your code: interface RequestOptions { method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; path: string; query?: Record<string, string | number | boolean>; body?: unknown; headers?: Record<string, string>; } interface Response<T = unknown> { status: number; headers: Record<string, string>; body: T; } declare const api: { request<T = unknown>(options: RequestOptions): Promise<Response<T>>; }; Your code must be an async arrow function that returns the result.
Search the API specification to discover available endpoints. Resolvable $refs are expanded inline; circular and max-depth refs remain marked. Types: interface OperationInfo { summary?: string; description?: string; tags?: string[]; parameters?: Array<{ name: string; in: string; required?: boolean; schema?: unknown; description?: string }>; requestBody?: { required?: boolean; content?: Record<string, { schema?: unknown }> }; responses?: Record<string, { description?: string; content?: Record<string, { schema?: unknown }> }>; } interface PathItem { get?: OperationInfo; post?: OperationInfo; put?: OperationInfo; patch?: OperationInfo; delete?: OperationInfo; } declare const spec: { paths: Record<string, PathItem>; }; Your code must be an async arrow function that returns the result.
No input validation or schema constraints. Both tools accept arbitrary JavaScript code strings with no type checking, length limits, or pattern validation. LLMs can pass malicious or nonsensical code without friction.
No output schema documentation. Tool descriptions mention TypeScript interfaces (OperationInfo, PathItem, Response) but these are not formally declared as return types. LLMs cannot plan downstream operations without knowing the response structure.
Generic tool names ('search', 'execute') do not convey domain or action specificity. Names like 'search_openapi_spec' and 'execute_api_request' would better signal intent and reduce LLM confusion when many tools are available.
No error handling or recovery guidance. If code execution fails, times out, or throws an exception, the tool provides no actionable error message or retry strategy. LLMs receive raw errors with no context.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 40 | 2026-07-28+ | v2 |
Code-execution interface bypasses traditional tool composition. LLMs must write and reason about JavaScript code rather than declarative parameters. This increases hallucination risk, makes auditing difficult, and violates the single-responsibility principle.