api_schemas
Extract parameters, request body, and responses using the operationId from ACOMO API schemas. Simplify API exploration and operation analysis within the ACOMO MCP Server.
Instructions
operationIdからparameters/requestBody/responsesを抜粋
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operationId | Yes |
Implementation Reference
- src/server.ts:97-111 (handler)Handler function for the 'api_schemas' tool. It retrieves the operation schemas using getOperationSchemas and returns them as formatted JSON text or an error if not found.async ({ operationId }: { operationId: string }) => { const schemas = await getOperationSchemas(operationId); if (!schemas) return { content: [ { type: "text", text: `Unknown operationId: ${operationId}` }, ], isError: true, }; return { content: [ { type: "text", text: JSON.stringify(schemas, null, 2) }, ], }; }
- src/server.ts:95-95 (schema)Zod input schema definition for the 'api_schemas' tool, requiring an 'operationId' string.inputSchema: { operationId: z.string() },
- src/server.ts:90-112 (registration)Registration of the 'api_schemas' tool using server.registerTool, including title, description, input schema, and inline handler.server.registerTool( "api_schemas", { title: "API schemas", description: "operationIdからparameters/requestBody/responsesを抜粋", inputSchema: { operationId: z.string() }, }, async ({ operationId }: { operationId: string }) => { const schemas = await getOperationSchemas(operationId); if (!schemas) return { content: [ { type: "text", text: `Unknown operationId: ${operationId}` }, ], isError: true, }; return { content: [ { type: "text", text: JSON.stringify(schemas, null, 2) }, ], }; } );
- src/openapi.ts:84-118 (helper)Core helper function getOperationSchemas that extracts parameters, requestBody schema, and responses from the OpenAPI operation for the given operationId. This is called by the tool handler.export async function getOperationSchemas(operationId: string): Promise<{ operationId: string; method: string; path: string; parameters: any[]; // path/query/header requestBody?: any; // schema if available responses?: Record<string, any>; // status -> schema/desc } | null> { const found = await findOperationById(operationId); if (!found) return null; const op = found.raw || {}; const parameters = op.parameters ?? []; let requestBody: any | undefined; if (op.requestBody?.content) { // prefer application/json const json = op.requestBody.content['application/json'] || Object.values(op.requestBody.content)[0]; requestBody = json?.schema ?? json; } const responses: Record<string, any> = {}; if (op.responses) { for (const [code, res] of Object.entries(op.responses)) { const content = (res as any)?.content; const json = content?.['application/json'] || (content && Object.values(content)[0]); responses[code] = json?.schema ?? (res as any)?.description ?? res; } } return { operationId, method: found.method, path: found.path, parameters, requestBody, responses, }; }