Skip to main content
Glama
SmartBear

SmartBear MCP server

Official
by SmartBear

Swagger: Get API Definition

swagger_get_api_definition
Read-onlyIdempotent

Fetch resolved OpenAPI definitions from SwaggerHub Registry by owner, API, and version. Get JSON by default or YAML for editing.

Instructions

Fetch resolved API definition from SwaggerHub Registry based on owner, API name, and version. By default returns the definition as JSON (converting YAML-stored definitions to JSON). Set format:'text' to get the YAML definition — required as the source for swagger_patch_api edits.

Toolset: Registry API

Parameters:

  • owner (string) required: API owner (organization or user, case-sensitive)

  • api (string) required: API name (case-sensitive)

  • version (string) required: Version identifier

  • resolved (boolean): Set to true to get the resolved version with all external $refs included (default false)

  • flatten (boolean): Set to true to create models from inline schemas in OpenAPI definition (default false)

  • format (enum): Response format: 'json' (default) may convert YAML to JSON; 'text' returns the definition as YAML — required for swagger_patch_api edits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiYesAPI name (case-sensitive)
ownerYesAPI owner (organization or user, case-sensitive)
formatNoResponse format: 'json' (default) may convert YAML to JSON; 'text' returns the definition as YAML — required for swagger_patch_api edits.
flattenNoSet to true to create models from inline schemas in OpenAPI definition (default false)
versionYesVersion identifier
resolvedNoSet to true to get the resolved version with all external $refs included (default false)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
definitionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.40.0
  2. Removedv0.34.0
  3. Changed1 schema field changedv0.30.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "definition": {
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "definition"
      +  ],
      +  "type": "object"
      +}
  4. First observedv0.27.1

TDQS

A4.2/5.0
Behavior4/5

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

The description adds useful behavior beyond the annotations: it discloses YAML-to-JSON conversion by default, explains the resolved and flatten options, and specifies that format:'text' returns YAML for patching. These details complement the readOnlyHint and idempotentHint annotations and do not contradict them.

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?

The description is well-structured and front-loaded with the purpose and key caveats before the parameter list. It is reasonably concise, but the parameter bullet list duplicates the input schema, which keeps it from being maximally economical.

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?

For a read-only lookup with a fully documented schema and an available output schema, the description covers the core selection criteria, default format behavior, optional transformation flags, and the patch-workflow use case. Nothing essential for invoking the tool correctly is missing.

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%, and the parameter list in the description largely repeats the input schema verbatim. It adds no substantially new meaning beyond the schema, so the baseline score of 3 is appropriate.

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 first sentence states a clear verb and resource: 'Fetch resolved API definition from SwaggerHub Registry based on owner, API name, and version.' This identifies the exact lookup operation and differentiates it from sibling tools like swagger_patch_api and swagger_search_apis_and_domains, even without naming them.

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 description gives clear operational context: default JSON conversion behavior is explained, and format:'text' is explicitly described as required for swagger_patch_api edits. It does not explicitly mention alternatives for searching or listing definitions, but the usage context is strong and actionable.

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

Deploy Server

Other Tools