Skip to main content
Glama
SmartBear

SmartBear MCP server

Official
by SmartBear

Swagger: Create or Update API

swagger_create_or_update_api
DestructiveIdempotent

Create or update an API in SwaggerHub Registry from an OpenAPI or AsyncAPI definition. Version and spec type are detected automatically, simplifying registry management.

Instructions

Create a new API or update an existing API in SwaggerHub Registry for Swagger Studio. The API specification type (OpenAPI, AsyncAPI) is automatically detected from the definition content. On create, private visibility and automock disabled are always used and cannot be changed via this tool. The version is taken from 'version' if provided, otherwise from the definition's info.version field — include a non-empty info.version if you omit 'version', or the request fails with a 400 error. Returns HTTP 201 for creation, HTTP 200 for update. Response includes 'operation' field indicating whether it was a 'create' or 'update' operation along with API details and SwaggerHub URL.

Toolset: Registry API

Parameters:

  • owner (string) required: Organization name (owner of the API)

  • apiName (string) required: API name

  • definition (string) required: API definition content (OpenAPI/AsyncAPI specification in JSON or YAML format). Format is automatically detected. On create, private visibility, automock disabled, and no project assignment are always used. On update, the API's existing visibility is preserved. The version is taken from the version parameter if provided, otherwise from this definition's info.version field — include a non-empty info.version if you omit the version parameter, or the request fails.

  • version (string): API version to create or update (e.g. '1.0.0'). If omitted, the version is taken from the definition's info.version field, which must then be a non-empty value or the request fails with a 400 error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesOrganization name (owner of the API)
apiNameYesAPI name
versionNoAPI version to create or update (e.g. '1.0.0'). If omitted, the version is taken from the definition's info.version field, which must then be a non-empty value or the request fails with a 400 error.
definitionYesAPI definition content (OpenAPI/AsyncAPI specification in JSON or YAML format). Format is automatically detected. On create, private visibility, automock disabled, and no project assignment are always used. On update, the API's existing visibility is preserved. The version is taken from the version parameter if provided, otherwise from this definition's info.version field — include a non-empty info.version if you omit the version parameter, or the request fails.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlNo
ownerNo
apiNameNo
versionNo
operationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.42.0
    • changedInput schema / properties / definition / description
      Previous value: -"API definition content (OpenAPI/AsyncAPI specification in JSON or YAML format). Format is automatically detected. On create, fixed values are used: version 1.0.0, private visibility, automock disabled, and no project assignment. On update, the API's existing visibility is preserved."New value: +"API definition content (OpenAPI/AsyncAPI specification in JSON or YAML format). Format is automatically detected. On create, private visibility, automock disabled, and no project assignment are always used. On update, the API's existing visibility is preserved. The version is taken from the version parameter if provided, otherwise from this definition's info.version field — include a non-empty info.version if you omit the version parameter, or the request fails."
    • addedInput schema / properties / version
      Added value: +{
      +  "description": "API version to create or update (e.g. '1.0.0'). If omitted, the version is taken from the definition's info.version field, which must then be a non-empty value or the request fails with a 400 error.",
      +  "type": [
      +    "string",
      +    "null"
      +  ]
      +}
  2. Addedv0.40.0
  3. Removedv0.34.0
  4. Changed1 schema field changedv0.30.0
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "apiName": {
      +      "type": "string"
      +    },
      +    "operation": {
      +      "enum": [
      +        "create",
      +        "update"
      +      ],
      +      "type": "string"
      +    },
      +    "owner": {
      +      "type": "string"
      +    },
      +    "url": {
      +      "type": "string"
      +    },
      +    "version": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  5. First observedv0.27.1

TDQS

A3.9/5.0
Behavior5/5

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

Goes well beyond the annotations (readOnlyHint=false, destructiveHint=true, idempotentHint=true) by disclosing that create always forces private visibility and disabled automock with no project assignment, that update preserves existing visibility, that failing to supply a usable version yields a 400, and that responses are 201 vs 200 with an 'operation' field. These are exactly the side effects an agent must know before calling a destructive mutation.

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?

Front-loaded with the core action and the most consequential constraint (version fallback and 400 failure) in the first paragraph. It loses a little to redundancy — the version-from-info.version rule is stated in the body and then again in two parameter entries.

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?

For a 4-parameter mutation with annotations and an output schema present, the description is nearly complete: failure modes, default visibility behavior, and status codes are all covered. It does not address permissions/ownership requirements or what happens on update to an API that does not exist.

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 baseline is 3. The description adds real meaning around version resolution and definition auto-detection, but it largely restates the schema's own parameter text, including the repeated 400-error note.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description gives a specific verb pair and resource ('Create a new API or update an existing API in SwaggerHub Registry') plus the target surface (Swagger Studio). It is clearly recognizable as the create/update counterpart to siblings like swagger_patch_api and swagger_create_api_from_prompt, though it never names an alternative explicitly to draw the boundary.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: create-vs-update behavior differs (visibility handling, version resolution), which hints at when each path applies. However, there is no guidance on when to choose this tool over swagger_patch_api or swagger_create_api_from_prompt, and no prerequisite/auth context.

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