← All MCP tools

MCP tool

set_connection

Switch an adapter between sandbox and live mode and optionally set its credentials. Live mode requires canonical credentials, implemented live provenance and a current human-verified supplier dossier. A campaign-specific, capped and expiring live-execution grant may also be required at launch; this tool cannot create one. An agent also cannot change a connection while an issued supplier grant exists, because the required safety revocation must be human-attributed. Sandbox needs none. Returns the updated connection.

Input

Pass fields from this schema as the tool arguments. Runtime ownership, product scope and readiness checks still apply.

Input JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "key": {
      "type": "string",
      "description": "adapter key from list_connections"
    },
    "agentStepId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "pending execute-step id that consumed the exact approved action"
    },
    "expectedActionDigest": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$",
      "description": "SHA-256 digest returned for the exact approved action"
    },
    "mode": {
      "type": "string",
      "enum": [
        "sandbox",
        "live"
      ],
      "description": "target mode"
    },
    "credentials": {
      "description": "vendor credentials as string key/value pairs (only needed for live mode)",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "required": [
    "key",
    "agentStepId",
    "expectedActionDigest",
    "mode"
  ]
}

REST mapping and authority

The tool wraps this REST endpoint. The mapping identifies path/query/body transformations and approval or idempotency headers.

Request contract
{
  "method": "PATCH",
  "path": "/api/v1/connections/{key}",
  "pathFields": [
    "key"
  ],
  "pathSchema": {
    "type": "object",
    "properties": {
      "key": {
        "type": "string",
        "description": "adapter key from list_connections"
      }
    },
    "additionalProperties": false,
    "required": [
      "key"
    ]
  },
  "pathEncoding": "encodeURIComponent for each path field",
  "governedAction": "connection.update",
  "headers": {
    "x-chorus-agent-step-id": "agentStepId",
    "x-chorus-agent-action-digest": "expectedActionDigest"
  },
  "bodySchema": {
    "type": "object",
    "properties": {
      "mode": {
        "type": "string",
        "enum": [
          "sandbox",
          "live"
        ],
        "description": "target mode"
      },
      "credentials": {
        "description": "vendor credentials as string key/value pairs (only needed for live mode)",
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "string"
        }
      }
    },
    "additionalProperties": false,
    "required": [
      "mode"
    ]
  },
  "responseMapping": "REST JSON is returned as MCP structuredContent and a compatibility text block; privacy-sensitive tools validate their output schema."
}

Output

This is the registered MCP output envelope. Nested fields are only modeled where the schema explicitly defines them.

Output JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "connection": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "connection"
  ],
  "additionalProperties": {}
}

Safety annotations

MCP annotations
{
  "readOnlyHint": false,
  "destructiveHint": true,
  "idempotentHint": true,
  "openWorldHint": false
}

Annotations help a client present the tool. The API independently enforces authorization and exact action approvals. Error and retry guidance →

set_connection | AdBuyMCP docs