MCP Tools

import_openapi

Imports an OpenAPI 3.0 or 3.1 spec as a collection of requests.

Overview

import_openapi imports an OpenAPI 3.0 or 3.1 spec, in JSON or YAML, as a collection with a folder per tag. Pass the spec's text as spec, or an http or https URL to download it from. Use url for specs over a few megabytes.

{
  "url": "https://api.example.com/openapi.yaml",
  "name": "Orders API"
}

This tool accepts only OpenAPI. import_collection takes the same arguments, with the document in content, and also imports Postman collections and environments. Prefer it in new integrations.

Parameters

Prop

Type

Return Value

The same object import_collection returns for a collection:

{
  "kind": "collection",
  "format": "openapi",
  "formatVersion": "3.0.3",
  "workspaceId": "4A8C1E3F-5B7D-4920-8E6A-0C2D4F6B8A19",
  "workspaceName": "Orders API",
  "collectionId": "A1F3D5B7-0C2E-4A6B-8D9F-1E3C5A7B9D02",
  "collectionName": "Orders API",
  "requestCount": 14,
  "folderCount": 3,
  "baseUrl": "https://api.example.com/v2",
  "auth": "Bearer Token",
  "authScope": "workspace",
  "variablesAdded": ["baseUrl", "bearerToken"],
  "variableScope": "workspace",
  "renamedVariables": [],
  "warnings": []
}

For a description of each field, see import_collection.

Discussion

In a new workspace, stored in Relay, the spec's baseUrl variable, its empty credential variables and its auth go on the workspace. In an existing workspace they go on the collection, where they apply only to its requests. Credential variables start out secret, so their values stay on your Mac.

The tool returns an error for a Postman collection or environment, suggesting import_collection instead, and for Swagger 2.0 specs, which Relay doesn't import. Its other errors are the same as import_collection's.

See Also