list_endpoints
Retrieve all API endpoints by extracting and displaying details from Swagger/OpenAPI documentation for exploration and testing.
Instructions
List all available API endpoints after fetching Swagger documentation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.js:169-177 (registration)Registers the 'list_endpoints' tool in the MCP tools array, including its description and empty input schema (no parameters required).{ name: "list_endpoints", description: "List all available API endpoints after fetching Swagger documentation", inputSchema: { type: "object", properties: {}, required: [], }, },
- src/server.js:172-176 (schema)Defines the input schema for the 'list_endpoints' tool: an empty object (no input parameters).inputSchema: { type: "object", properties: {}, required: [], },
- src/server.js:476-503 (handler)The core handler function that extracts and formats the list of API endpoints from the loaded Swagger documentation (paths, methods, summaries, operationIds, tags).function listEndpoints() { if (!swaggerDoc) { throw new Error('Swagger documentation not loaded. Call fetch_swagger_info first.'); } const endpoints = []; const paths = swaggerDoc.paths || {}; for (const path in paths) { const methods = Object.keys(paths[path]).filter(key => ['get', 'post', 'put', 'delete', 'patch', 'options', 'head'].includes(key.toLowerCase()) ); methods.forEach(method => { const operation = paths[path][method]; endpoints.push({ path, method: method.toUpperCase(), summary: operation.summary || '', operationId: operation.operationId || '', tags: operation.tags || [] }); }); } return endpoints; }
- src/server.js:990-1007 (handler)MCP request handler case for 'list_endpoints' tool: checks swaggerDoc, calls listEndpoints(), and returns JSON stringified result in the required MCP response format.case "list_endpoints": { try { if (!swaggerDoc) { throw new Error('Swagger documentation not loaded. Call fetch_swagger_info first.'); } const endpoints = listEndpoints(); return { content: [{ type: "text", text: JSON.stringify(endpoints) }], isError: false, }; } catch (error) { throw new Error(`Failed to list endpoints: ${error.message}`); } }