Skip to main content
Glama
amrsa1

Swagger MCP Server

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}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool lists endpoints after fetching Swagger documentation, implying a two-step process, but doesn't detail what 'fetching' entails (e.g., network calls, caching, errors) or the output format. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any fluff. It's appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (involving Swagger fetching) and lack of annotations or output schema, the description is minimally adequate. It mentions the Swagger dependency but doesn't explain the return format or error handling, leaving room for improvement in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a high baseline score for not adding unnecessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all available API endpoints') and the resource ('API endpoints'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_endpoint_details' or 'fetch_swagger_info', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_endpoint_details' or 'fetch_swagger_info'. It mentions fetching Swagger documentation, but doesn't clarify if this is a prerequisite or how it relates to other tools, leaving usage context unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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