Skip to main content
Glama
amrsa1

Swagger MCP Server

get_endpoint_details

Retrieve detailed specifications for API endpoints, including parameters and responses, from Swagger/OpenAPI documentation to understand and test API behavior.

Instructions

Get detailed information about a specific API endpoint

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe endpoint path to get details for (e.g., '/users/{id}')
methodYesThe HTTP method (GET, POST, PUT, DELETE, etc.)

Implementation Reference

  • The core handler function that extracts and formats detailed information about a specific API endpoint (path and method) from the loaded Swagger documentation, including parameters, requestBody, and responses.
    function getEndpointDetails(path, method) {
      if (!swaggerDoc) {
        throw new Error('Swagger documentation not loaded. Call fetch_swagger_info first.');
      }
      
      const paths = swaggerDoc.paths || {};
      method = method.toLowerCase();
      
      if (!paths[path] || !paths[path][method]) {
        throw new Error(`Endpoint ${method.toUpperCase()} ${path} not found in the Swagger documentation`);
      }
      
      const endpoint = paths[path][method];
      const parameters = endpoint.parameters || [];
      const responses = endpoint.responses || {};
      
      const formattedResponses = {};
      for (const statusCode in responses) {
        formattedResponses[statusCode] = {
          description: responses[statusCode].description || '',
          schema: responses[statusCode].schema || null,
          examples: responses[statusCode].examples || null
        };
      }
      
      return {
        summary: endpoint.summary || '',
        description: endpoint.description || '',
        operationId: endpoint.operationId || '',
        parameters,
        requestBody: endpoint.requestBody || null,
        responses: formattedResponses,
        consumes: endpoint.consumes || swaggerDoc.consumes || ['application/json'],
        produces: endpoint.produces || swaggerDoc.produces || ['application/json']
      };
    }
  • The input schema definition for the get_endpoint_details tool, specifying path and method as required string parameters.
    {
      name: "get_endpoint_details",
      description: "Get detailed information about a specific API endpoint",
      inputSchema: {
        type: "object",
        properties: {
          path: { 
            type: "string", 
            description: "The endpoint path to get details for (e.g., '/users/{id}')"
          },
          method: { 
            type: "string", 
            description: "The HTTP method (GET, POST, PUT, DELETE, etc.)" 
          }
        },
        required: ["path", "method"],
      },
    },
  • The registration and dispatching logic in the CallToolRequestSchema handler's switch statement, which extracts arguments, validates them, calls the handler, and returns the result.
    case "get_endpoint_details": {
      const path = request.params.arguments?.path;
      const method = request.params.arguments?.method;
      
      if (!path || !method) {
        throw new Error("Both path and method are required");
      }
    
      try {
        const details = getEndpointDetails(path, method);
        return {
          content: [{ 
            type: "text", 
            text: JSON.stringify(details)
          }],
          isError: false,
        };
      } catch (error) {
        throw new Error(`Failed to get endpoint details: ${error.message}`);
      }
    }
  • src/server.js:260-262 (registration)
    The server capabilities registration where the tools array (including get_endpoint_details) is registered with the MCP Server instance.
    capabilities: {
      tools: tools.reduce((acc, tool) => ({ ...acc, [tool.name]: tool }), {}),
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get'), but doesn't mention whether it requires authentication, has rate limits, what format the detailed information is returned in, or any error conditions. For a tool with zero annotation coverage, this is inadequate.

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 gets straight to the point with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential information.

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

Completeness2/5

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

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what 'detailed information' includes, how results are formatted, or any behavioral aspects. Given the complexity of API endpoints and the lack of structured data, more context is needed for the agent to use this tool effectively.

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

Parameters3/5

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

The schema description coverage is 100%, with both parameters clearly documented in the input schema. The description doesn't add any additional meaning about the parameters beyond what's already in the schema, so it meets the baseline score when the schema does the heavy lifting.

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 verb ('Get') and resource ('detailed information about a specific API endpoint'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'fetch_swagger_info' or 'list_endpoints' that might also provide API information, so it doesn't reach the highest 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 'fetch_swagger_info' or 'list_endpoints'. It doesn't mention prerequisites, exclusions, or specific contexts for usage, leaving the agent to infer this from the tool name alone.

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