Skip to main content
Glama

list_endpoints

Discover available API operations by listing all endpoints in the Swagger Petstore OpenAPI 3.0 specification. Use this tool to identify operationIds before making requests.

Instructions

List all available endpoints in the Swagger Petstore - OpenAPI 3.0. Call this first to discover what operations are available and get their operationIds.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration and handler implementation for the list_endpoints tool. It calls getEndpointSummaries to generate the output.
    server.tool(
      "list_endpoints",
      `List all available endpoints in the ${apiTitle}. ` +
        "Call this first to discover what operations are available and get their operationIds.",
      {},
      async () => ({
        content: [{ type: "text" as const, text: getEndpointSummaries(spec) }],
      })
    );
  • Helper function that generates the formatted summary of endpoints for the list_endpoints tool.
    export function getEndpointSummaries(spec: OpenAPIV3.Document): string {
      const endpoints = getAllEndpoints(spec);
      const lines: string[] = [
        `# ${spec.info.title} (v${spec.info.version})`,
        "",
      ];
    
      if (spec.info.description) {
        lines.push(spec.info.description.split("\n")[0], "");
      }
    
      if (spec.servers?.[0]?.url) {
        lines.push(`Base URL: ${spec.servers[0].url}`, "");
      }
    
      // Group by first tag
      const byTag = new Map<string, EndpointInfo[]>();
      for (const ep of endpoints) {
        const tag = ep.operation.tags?.[0] ?? "General";
        if (!byTag.has(tag)) byTag.set(tag, []);
        byTag.get(tag)!.push(ep);
      }
    
      for (const [tag, eps] of byTag) {
        lines.push(`## ${tag}`);
        for (const ep of eps) {
          const summary = ep.operation.summary ?? ep.operation.description ?? "";
          lines.push(
            `- **${ep.operationId}** \`${ep.method.toUpperCase()} ${ep.path}\`${summary ? ` — ${summary}` : ""}`
          );
    
          const params = (ep.operation.parameters ?? []) as OpenAPIV3.ParameterObject[];
          const required = params.filter((p) => p.required).map((p) => `${p.name} (${p.in})`);
          const optional = params.filter((p) => !p.required).map((p) => `${p.name} (${p.in})`);
    
          if (required.length > 0) {
            lines.push(`  Required params: ${required.join(", ")}`);
          }
          if (optional.length > 0) {
            lines.push(`  Optional params: ${optional.join(", ")}`);
          }
    
          const requestBody = ep.operation.requestBody as OpenAPIV3.RequestBodyObject | undefined;
          if (requestBody) {
            const bodyRequired = requestBody.required ? " (required)" : " (optional)";
            lines.push(`  Request body${bodyRequired}`);
          }
        }
        lines.push("");
      }
    
      lines.push(`Total: ${endpoints.length} endpoint${endpoints.length !== 1 ? "s" : ""}`);
      return lines.join("\n");
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that this is a read-only discovery tool ('List all available endpoints'), which implies safe, non-destructive behavior. However, it lacks details on potential rate limits, authentication needs, or response format, leaving some behavioral aspects unspecified.

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 front-loaded with the core purpose in the first sentence and follows with a concise usage guideline. Every sentence earns its place by providing essential information without redundancy, making it efficiently structured and appropriately sized for a simple tool.

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

Completeness4/5

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

Given the tool's low complexity (0 parameters, no output schema, no annotations), the description is largely complete. It explains what the tool does and when to use it. However, it could be slightly more complete by hinting at the response format (e.g., list of endpoints with operationIds), though this is a minor gap for such a simple tool.

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, meaning no parameters are documented in the schema. The description does not mention any parameters, which is appropriate since none exist. It adds value by explaining the tool's purpose and usage, compensating for the lack of parameter documentation in the schema.

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 specific action ('List all available endpoints') and resource ('in the Swagger Petstore - OpenAPI 3.0'), distinguishing it from the sibling tool 'call_endpoint' which would execute operations rather than list them. The phrase 'Call this first to discover what operations are available' reinforces its distinct discovery purpose.

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

Usage Guidelines5/5

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

The description explicitly provides usage guidance: 'Call this first to discover what operations are available and get their operationIds.' This indicates when to use this tool (as an initial discovery step) and implicitly suggests an alternative (using 'call_endpoint' once operations are known), making it clear in context with the sibling tool.

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/saurav61091/mcp-openapi'

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