Skip to main content
Glama
gyuco
by gyuco

get_swagger_documentation

Fetch the full Swagger/OpenAPI specification to explore and understand all REST API endpoints.

Instructions

Get the complete Swagger/OpenAPI documentation for available endpoints

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler method in the McpRestServer class that executes the tool logic. It checks that the REST client is configured, then calls this.restClient.getSwaggerDocumentation() and returns the result as tool output.
    private async getSwaggerDocumentation() {
      if (!this.restClient) {
        throw new Error(
          "REST client not configured. Use configure_rest_client tool or provide configuration via CLI/environment variables."
        );
      }
    
      const documentation = this.restClient.getSwaggerDocumentation();
      return {
        content: [
          {
            type: "text",
            text: documentation,
          },
        ],
      };
    }
  • src/index.ts:48-218 (registration)
    The tool registration in the ListToolsRequestSchema handler. Defines the tool name 'get_swagger_documentation', its description, and empty inputSchema (no params required).
    private setupHandlers(): void {
      this.server.setRequestHandler(ListToolsRequestSchema, async () => {
        return {
          tools: [
            {
              name: "configure_rest_client",
              description:
                "Configure the REST client with base URL, authentication, and optional Swagger documentation URL",
              inputSchema: {
                type: "object",
                properties: {
                  baseUrl: {
                    type: "string",
                    description: "Base URL for the REST API",
                  },
                  swaggerUrl: {
                    type: "string",
                    description:
                      "URL to Swagger/OpenAPI documentation (optional)",
                  },
                  auth: {
                    type: "object",
                    oneOf: [
                      {
                        type: "object",
                        properties: {
                          type: { type: "string", enum: ["token"] },
                          token: {
                            type: "string",
                            description: "Authentication token",
                          },
                        },
                        required: ["type", "token"],
                      },
                      {
                        type: "object",
                        properties: {
                          type: { type: "string", enum: ["login"] },
                          username: {
                            type: "string",
                            description: "Username for login",
                          },
                          password: {
                            type: "string",
                            description: "Password for login",
                          },
                          loginEndpoint: {
                            type: "string",
                            description: "Login endpoint path",
                          },
                          tokenField: {
                            type: "string",
                            description:
                              "Field name for access token in response (default: access_token)",
                          },
                        },
                        required: [
                          "type",
                          "username",
                          "password",
                          "loginEndpoint",
                        ],
                      },
                    ],
                  },
                  timeout: {
                    type: "number",
                    description:
                      "Request timeout in milliseconds (default: 30000)",
                  },
                  retries: {
                    type: "number",
                    description:
                      "Number of retries for failed requests (default: 3)",
                  },
                },
                required: ["baseUrl", "auth"],
              },
            },
            {
              name: "http_request",
              description: "Make an HTTP request to the configured API",
              inputSchema: {
                type: "object",
                properties: {
                  method: {
                    type: "string",
                    enum: ["GET", "POST", "PUT", "DELETE", "PATCH"],
                    description: "HTTP method",
                  },
                  path: {
                    type: "string",
                    description: "API endpoint path",
                  },
                  params: {
                    type: "object",
                    description:
                      "Query parameters (for GET) or request body parameters",
                  },
                  body: {
                    type: "object",
                    description: "Request body (for POST, PUT, PATCH)",
                  },
                  headers: {
                    type: "object",
                    description: "Additional headers",
                  },
                },
                required: ["method", "path"],
              },
            },
            {
              name: "get_swagger_documentation",
              description:
                "Get the complete Swagger/OpenAPI documentation for available endpoints",
              inputSchema: {
                type: "object",
                properties: {},
              },
            },
            {
              name: "search_endpoints",
              description: "Search for endpoints in the Swagger documentation",
              inputSchema: {
                type: "object",
                properties: {
                  query: {
                    type: "string",
                    description: "Search query to find matching endpoints",
                  },
                },
                required: ["query"],
              },
            },
            {
              name: "get_endpoint_info",
              description: "Get detailed information about a specific endpoint",
              inputSchema: {
                type: "object",
                properties: {
                  path: {
                    type: "string",
                    description: "Endpoint path",
                  },
                  method: {
                    type: "string",
                    description: "HTTP method",
                  },
                },
                required: ["path", "method"],
              },
            },
            {
              name: "check_authentication",
              description: "Check if the client is currently authenticated",
              inputSchema: {
                type: "object",
                properties: {},
              },
            },
            {
              name: "logout",
              description: "Logout and clear authentication state",
              inputSchema: {
                type: "object",
                properties: {},
              },
            },
          ] as Tool[],
        };
      });
  • src/index.ts:220-262 (registration)
    The CallToolRequestSchema handler that routes the tool call to the getSwaggerDocumentation method when name matches 'get_swagger_documentation'.
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      try {
        switch (name) {
          case "configure_rest_client":
            return await this.configureRestClient(args);
    
          case "http_request":
            return await this.makeHttpRequest(args);
    
          case "get_swagger_documentation":
            return await this.getSwaggerDocumentation();
    
          case "search_endpoints":
            return await this.searchEndpoints(args);
    
          case "get_endpoint_info":
            return await this.getEndpointInfo(args);
    
          case "check_authentication":
            return await this.checkAuthentication();
    
          case "logout":
            return await this.logout();
    
          default:
            throw new Error(`Unknown tool: ${name}`);
        }
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${
                error instanceof Error ? error.message : "Unknown error"
              }`,
            },
          ],
          isError: true,
        };
      }
    });
  • The RestClient.getSwaggerDocumentation() helper method that delegates to SwaggerDocumentationParser.getEndpointSummary(). Returns a formatted string of all available endpoints or a message if Swagger is not configured.
    getSwaggerDocumentation(): string {
      if (!this.swaggerParser) {
        return "Swagger documentation not configured";
      }
      return this.swaggerParser.getEndpointSummary();
    }
  • The SwaggerDocumentationParser.getEndpointSummary() method that formats all parsed endpoints into a human-readable summary string listing method, path, and optional summary for each endpoint.
    getEndpointSummary(): string {
      if (!this.parsed) {
        return "Documentation not loaded";
      }
    
      const summary = this.endpoints
        .map(
          (endpoint) =>
            `${endpoint.method} ${endpoint.path}${
              endpoint.summary ? ` - ${endpoint.summary}` : ""
            }`
        )
        .join("\n");
    
      return `Available endpoints (${this.endpoints.length}):\n${summary}`;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. It does not mention that this is a read-only operation, the format of the output (e.g., JSON/YAML), or any potential size or performance implications.

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 sentence of 10 words, highly concise and front-loaded. Every word serves a purpose, with no redundancy.

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 no parameters and no output schema, the description is minimal but adequate for a simple documentation retrieval tool. However, it lacks behavioral details and usage hints, making it barely sufficient.

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 no parameters, so baseline is 4. The description adds no parameter information (none needed), meeting the baseline expectation.

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

Purpose5/5

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

The description clearly states the tool retrieves the complete Swagger/OpenAPI documentation for available endpoints. The verb 'Get' and resource 'complete Swagger/OpenAPI documentation' are specific, and it distinguishes from siblings like get_endpoint_info which returns a single endpoint's info.

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_info or search_endpoints. It only states what it does, leaving the agent to infer context.

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/gyuco/mcp-http-client'

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