Skip to main content
Glama

Generate OpenAPI From Source Code

generate-swagger-api

Use this when the user supplies API source code and asks for an OpenAPI or Swagger specification. After authorization, this state-changing action consumes AI credits, creates a generation, and returns OpenAPI JSON; it accepts one source_code file or multiple files entries.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoOptional generation history name for the generated OpenAPI output. Defaults to the supplied filename or comma-separated filenames.
filesNoMultiple supplied file contents for one OpenAPI spec. Use this when the customer pasted or supplied several files directly; use browser guidance for local uploads.
filenameNoFilename for source_code in the single-file path. Omit when using files[].
source_codeNoSource code to analyze for a single supplied file. Provide filename too. Omit when using files[].
save_to_spaceNoOptional destination Space item.
additional_instructionsNoOptional generation instructions.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Discloses that it is a state-changing action, consumes AI credits, creates a generation, and returns OpenAPI JSON—information not present in the annotations (which only indicate non-read-only and non-destructive).

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?

Two sentences front-load the purpose and then cover core behavior and input modes. No redundancy or extraneous detail.

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?

While the schema covers all parameters (including optional save_to_space and additional_instructions), the description does not mention these optional fields or the absence of an output schema. However, the core usage is fully explained, and the schema fills the remaining gaps.

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 already provides detailed descriptions for all parameters, including the mutual exclusivity of single-file vs. files[] modes. The description only reiterates 'one source_code file or multiple files entries' without adding new semantic detail.

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?

Clearly states it generates an OpenAPI/Swagger specification from user-supplied API source code, distinguishing it from other generation tools by the specific output type.

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?

Explicitly says 'Use this when the user supplies API source code and asks for an OpenAPI or Swagger specification,' giving a direct condition for when to select this tool over alternatives.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources