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 and can save the result to a Space, where it may be publicly accessible.

Input 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.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, destructiveHint=false, and openWorldHint=true. The description adds meaningful context beyond these: it consumes AI credits, creates a generation, requires authorization, and warns that saved results in a Space may be publicly accessible. That is substantive disclosure, though it doesn't cover reversibility or rate limits.

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

Conciseness4/5

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

Two sentences, with the usage condition front-loaded before the behavioral/payload details. Dense but wastes little; the only mild looseness is packing the input-path and Space caveats into the second clause.

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?

With no output schema, the description correctly states the return (OpenAPI JSON) and notes auth, credit consumption, and public Space exposure. Given full schema coverage and nested objects, this is essentially complete, though save_to_space semantics and the parent_id option aren't clarified.

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?

Schema description coverage is 100%, so the schema already fully documents all 6 parameters (including the nested files[] path). The description notes the single-file vs. multiple-files paths and the Space-save option, but this largely restates what the schema already explains, so baseline 3 applies.

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 states a specific verb (generate), resource (OpenAPI/Swagger specification), and input (API source code). It clearly distinguishes itself from siblings like generate-code-documentation or generate-repository-documentation by naming the exact output type, so an agent can select it without opening the schema.

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

Usage Guidelines4/5

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

The opening sentence gives an explicit trigger condition: use when the user supplies API source code and asks for an OpenAPI/Swagger spec. It clarifies usage context well but does not name a sibling alternative or state when NOT to use this tool, so it falls short of a full 5.

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.