Skip to main content
Glama
SmartBear

SmartBear MCP server

Official
by SmartBear

Swagger: Patch API

swagger_patch_api
DestructiveIdempotent

Apply targeted search/replace edits to YAML OpenAPI/AsyncAPI definitions in SwaggerHub Registry to fix specific issues; nothing is saved unless every edit applies.

Instructions

Apply targeted search/replace edits to a YAML API definition in SwaggerHub Registry. Only OpenAPI and AsyncAPI definitions are supported. Each edit's 'oldString' must be copied exactly from swagger_get_api_definition with format:'text' and without 'resolved' or 'flatten' — those options transform the definition, so edits based on them will not match the stored source. JSON definitions are not supported. Nothing is saved unless every edit applies — failed edits are returned with 'no_match' or 'ambiguous' status. When 'newVersion' is given the patched definition is saved as a new private version; patching in place keeps the visibility of the existing version. Use this tool to fix specific issues in an existing API without regenerating the whole definition.

Toolset: Registry API

Parameters:

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

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

  • version (string) required: Version of the definition to patch (base version, e.g. '1.0.0')

  • newVersion (string): Version to save the patched definition as (e.g. '1.0.1'). Must not already exist and is always created as private. Omit to overwrite the base version, which keeps its current visibility. The definition's info.version is updated automatically — do not add an edit for it.

  • edits (array) required: Search/replace edits applied sequentially to the YAML definition. Nothing is saved unless every edit applies (atomic).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
editsYesSearch/replace edits applied sequentially to the YAML definition. Nothing is saved unless every edit applies (atomic).
ownerYesAPI owner (organization or user, case-sensitive)
apiNameYesAPI name (case-sensitive)
versionYesVersion of the definition to patch (base version, e.g. '1.0.0')
newVersionNoVersion to save the patched definition as (e.g. '1.0.1'). Must not already exist and is always created as private. Omit to overwrite the base version, which keeps its current visibility. The definition's info.version is updated automatically — do not add an edit for it.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNo
savedNo
failedNoOnly present when at least one edit failed
versionNo
operationNo
Install Server

TDQS

A4.4/5.0
Behavior5/5

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

Beyond annotations (destructiveHint, idempotentHint), the description reveals atomicity ('Nothing is saved unless every edit applies'), failed-edit statuses ('no_match' or 'ambiguous'), version semantics (newVersion saved as private, in-place keeps visibility, info.version auto-updated), and the resolved/flatten matching trap. All of this is context an agent needs to predict side effects, and nothing contradicts the annotations.

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 narrative is front-loaded and every sentence in it earns its place, but the embedded Parameters section duplicates the input schema nearly verbatim, adding length without new information. Still, the key behavioral details are compactly ordered before the parameter list.

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 5-param tool with a nested edits array, the description plus schema covers everything needed: supported formats, exact-match sourcing, atomicity, version behavior, visibility, and the intended use case. The presence of an output schema covers return value details, so nothing essential 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 schema's per-parameter descriptions are rich (case-sensitivity, base version, private version, atomic edits, oldString sourcing). The description's Parameters section mostly duplicates the schema rather than adding new meaning, so it stays at the baseline for full schema coverage.

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 uses a specific verb+resource: 'Apply targeted search/replace edits to a YAML API definition in SwaggerHub Registry.' It names supported formats (OpenAPI/AsyncAPI) and excludes JSON, distinguishing it from broader tools like swagger_create_or_update_api or swagger_standardize_api. The final sentence reinforces its niche: fixing specific issues without regenerating the whole definition.

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?

It gives an explicit use case: 'Use this tool to fix specific issues in an existing API without regenerating the whole definition.' It also states hard constraints (only OpenAPI/AsyncAPI, JSON not supported) and references swagger_get_api_definition for the source text. However, it doesn't name an explicit alternative for full regeneration, leaving that to inference.

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

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/SmartBear/smartbear-mcp'

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