Get a REST endpoint
get_endpointRetrieve the complete OpenAPI operation object (parameters, request body, responses, security) for any REST endpoint by providing its HTTP method and path template.
Instructions
Get the full OpenAPI operation object (parameters, request body, responses, security) for a single REST endpoint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | HTTP method, e.g. `POST`. | |
| path | Yes | OpenAPI path template, e.g. `/v1/analyze/audio`. |
Implementation Reference
- src/lib/openapi.ts:71-80 (handler)The core handler function 'getEndpoint' that looks up an OpenAPI operation by HTTP method and path from the cached OpenAPI spec. Returns the method, path, and full operation object, or null if not found.
export async function getEndpoint(method: string, path: string): Promise<{ method: string; path: string; operation: OpenApiOperation; } | null> { const spec = await loadOpenApi(); const op = spec?.paths?.[path]?.[method.toLowerCase()]; if (!op) return null; return { method: method.toUpperCase(), path, operation: op }; } - src/lib/openapi.ts:3-12 (schema)TypeScript type 'OpenApiOperation' used as the return type for the endpoint operation data, defining the shape (summary, description, tags, parameters, requestBody, responses, security, operationId).
interface OpenApiOperation { summary?: string; description?: string; tags?: string[]; parameters?: unknown[]; requestBody?: unknown; responses?: Record<string, unknown>; security?: unknown[]; operationId?: string; } - src/lib/openapi.ts:24-34 (helper)Helper function 'loadOpenApi' that loads and caches the OpenAPI spec from the content store — called by getEndpoint to retrieve the spec.
export async function loadOpenApi(): Promise<OpenApiSpec | null> { if (cached) return cached; const entry = await getEntry("api/openapi"); if (!entry) return null; try { cached = JSON.parse(entry.body) as OpenApiSpec; return cached; } catch { return null; } }