Skip to main content
Glama

list_endpoints

Discover available API endpoints by fetching and parsing Swagger/OpenAPI documentation to explore API capabilities.

Instructions

List all available API endpoints after fetching Swagger documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that iterates over swaggerDoc.paths, identifies HTTP methods, and constructs a list of endpoints with path, method, summary, operationId, and 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:169-177 (registration)
    Tool registration in the tools array, including name, description, and empty input schema (no parameters required). This object is used in server capabilities.
    { name: "list_endpoints", description: "List all available API endpoints after fetching Swagger documentation", inputSchema: { type: "object", properties: {}, required: [], }, },
  • Input schema definition for the list_endpoints tool: an empty object (no input parameters).
    inputSchema: { type: "object", properties: {}, required: [], },
  • Dispatch handler in the CallToolRequestSchema switch statement that checks for swaggerDoc, calls listEndpoints(), and returns the JSON-formatted result as tool content.
    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}`); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/amrsa1/swagger-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server