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

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.7/5.0
Behavior5/5

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

Annotations only tell the agent this is a non-read-only, open-world, non-destructive call. The description adds meaningful specifics the annotations cannot convey: authorization is required, AI credits are consumed, a generation record is created, the return is OpenAPI JSON, and saving to a Space may make the output publicly accessible. That public-exposure warning is high-value disclosure for a state-changing action.

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 dense sentences with no filler: the usage trigger is front-loaded, followed by side effects and I/O shape. Every clause (auth, credits, mutation, return type, file paths, public Space) carries distinct information.

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

Completeness5/5

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

Though there is no output schema and the tool has six parameters including nested objects, the description covers the missing pieces an agent needs: invocation trigger, authorization, credit cost, mutation side effect, return type, and the public-visibility caveat for Space saves.

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?

Schema coverage is 100%, so the baseline is 3. The description adds framing beyond the schema by explaining the one-file versus multiple-files duality ('accepts one source_code file or multiple files entries') and the Space destination, which helps an agent pick the right parameter path even though the per-field semantics live 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?

States a specific verb and artifact: generate an OpenAPI/Swagger specification from supplied API source code, and even names the input form (source_code file or multiple files) and the return (OpenAPI JSON). This clearly separates it from the many sibling generate-* tools (UML, README, tests, comments) by input and output.

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?

Opens with an explicit trigger condition ('when the user supplies API source code and asks for an OpenAPI or Swagger specification') and routes between the single-file and files[] paths. It hints at an alternative for local uploads ('use browser guidance for local uploads') but does not fully state when-not to use it or name a specific sibling alternative.

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