agent-swarm.devagent-swarm.dev

Scripts

Author, search, and run reusable TypeScript scripts — a shared automation catalog callable across swarm agents and workflows

POST/api/mcp-bridge

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Header Parameters

X-Runtime-Instance-ID?string

Identifies the concrete runtime instance (worker process) making the call, as generated at its boot. Required to acquire work through bridged tools when multi-runtime mode (MULTI_RUNTIME_ENABLED) is on; ignored otherwise.

Idempotency-Key?string

Optional key, 1-255 visible ASCII characters, scoped to the caller and the tool. The first successful call of a tool that is not read-only runs it and records its result; a later call with the same key and tool returns that result (with Idempotent-Replayed: true) and runs nothing, whatever its args. A call that fails or that the tool refuses records nothing. A second call while the first still runs waits for it, then gets a 409. Read-only tools ignore the key. Records expire after 7 days. Durable script runs send one on every ctx.swarm call.

Match^[\x21-\x7E]{1,255}$

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/mcp-bridge" \  -H "Content-Type: application/json" \  -d '{    "tool": "string"  }'
Empty
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/scripts

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Query Parameters

scope?string
Value in"global" | "agent"
includeScratch?string
Value in"true" | "false"

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/scripts"
{
  "scripts": [
    {
      "id": "string",
      "name": "string",
      "scope": "global",
      "scopeId": "string",
      "description": "string",
      "intent": "string",
      "version": 0,
      "isScratch": true,
      "typeChecked": true,
      "fsMode": "none",
      "executor": "native",
      "createdByAgentId": "string",
      "updatedByAgentId": null,
      "createdBy": null,
      "updatedBy": null,
      "createdAt": "string",
      "updatedAt": "string",
      "kind": "function"
    }
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/scripts/{id}

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08"
{
  "script": {
    "id": "string",
    "name": "string",
    "scope": "global",
    "scopeId": "string",
    "source": "string",
    "description": "string",
    "intent": "string",
    "signatureJson": "string",
    "contentHash": "string",
    "version": 0,
    "isScratch": true,
    "typeChecked": true,
    "fsMode": "none",
    "executor": "native",
    "createdByAgentId": "string",
    "updatedByAgentId": null,
    "createdBy": null,
    "updatedBy": null,
    "createdAt": "string",
    "updatedAt": "string",
    "signature": {
      "kind": "durable",
      "methods": {
        "property1": {
          "argsType": "string",
          "resultType": "string",
          "description": "string"
        },
        "property2": {
          "argsType": "string",
          "resultType": "string",
          "description": "string"
        }
      },
      "argsType": "string",
      "resultType": "string",
      "description": "string"
    },
    "argsJsonSchema": {
      "property1": null,
      "property2": null
    },
    "created_by": "string",
    "updated_by": "string"
  }
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/scripts/{id}/apis

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08/apis"
{
  "apis": [
    {
      "id": "string",
      "scriptId": "string",
      "agentId": "string",
      "authMode": "none",
      "enabled": true,
      "label": "string",
      "callCount": 0,
      "lastUsedAt": "string",
      "createdAt": "string"
    }
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/scripts/{id}/apis

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08/apis" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "string",
  "scriptId": "string",
  "agentId": "string",
  "authMode": "none",
  "enabled": true,
  "label": "string",
  "callCount": 0,
  "lastUsedAt": "string",
  "createdAt": "string",
  "token": "string",
  "warnings": [
    "string"
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
DELETE/api/scripts/{id}/apis/{endpointId}

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid
endpointId*string

Response Body

application/json

application/json

curl -X DELETE "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08/apis/string"
{
  "deleted": true
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
PATCH/api/scripts/{id}/apis/{endpointId}

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid
endpointId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X PATCH "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08/apis/string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "id": "string",
  "scriptId": "string",
  "agentId": "string",
  "authMode": "none",
  "enabled": true,
  "label": "string",
  "callCount": 0,
  "lastUsedAt": "string",
  "createdAt": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/scripts/{id}/apis/{endpointId}/rotate

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid
endpointId*string

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08/apis/string/rotate"
{
  "id": "string",
  "scriptId": "string",
  "agentId": "string",
  "authMode": "none",
  "enabled": true,
  "label": "string",
  "callCount": 0,
  "lastUsedAt": "string",
  "createdAt": "string",
  "token": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/scripts/{id}/apis/{endpointId}/secret

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid
endpointId*string

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08/apis/string/secret"
{
  "token": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/scripts/{id}/versions

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

id*string
Formatuuid

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/scripts/497f6eca-6276-4993-bfeb-53cbbbba6f08/versions"
{
  "versions": [
    {
      "id": "string",
      "scriptId": "string",
      "version": 0,
      "source": "string",
      "description": "string",
      "intent": "string",
      "signatureJson": "string",
      "contentHash": "string",
      "changedByAgentId": "string",
      "changedAt": "string",
      "changeReason": "string",
      "created_by": "string",
      "updated_by": "string"
    }
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
DELETE/api/scripts/{name}

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

name*string
Length1 <= length <= 200

Query Parameters

scope?string
Default"agent"
Value in"global" | "agent"

Response Body

application/json

application/json

application/json

application/json

curl -X DELETE "http://localhost:3013/api/scripts/string"
{
  "deleted": true
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/scripts/{name}/types

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Path Parameters

name*string
Length1 <= length <= 200

Query Parameters

scope?string
Value in"global" | "agent"

Response Body

application/json

application/json

curl -X GET "http://localhost:3013/api/scripts/string/types"
{
  "signature": {
    "kind": "durable",
    "methods": {
      "property1": {
        "argsType": "string",
        "resultType": "string",
        "description": "string"
      },
      "property2": {
        "argsType": "string",
        "resultType": "string",
        "description": "string"
      }
    },
    "argsType": "string",
    "resultType": "string",
    "description": "string"
  },
  "argsJsonSchema": {
    "property1": null,
    "property2": null
  },
  "sdkTypes": "string",
  "stdlibTypes": "string"
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/scripts/run

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Header Parameters

X-Runtime-Instance-ID?string

Identifies the concrete runtime instance (worker process) making the call, as generated at its boot. Required to acquire work through the script SDK when multi-runtime mode (MULTI_RUNTIME_ENABLED) is on; ignored otherwise.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/scripts/run" \  -H "Content-Type: application/json" \  -d '{}'
{
  "result": null,
  "object": {
    "id": "string",
    "stateVersion": 0,
    "destroyed": true
  },
  "autoSaved": {
    "slug": "string",
    "reason": "string"
  },
  "kvSaved": {
    "namespace": "string",
    "key": "string"
  },
  "truncated": {
    "stdout": true,
    "stderr": true
  },
  "durationMs": 0,
  "stdout": "string",
  "stderr": "string",
  "exitCode": 0,
  "error": "timeout",
  "runtimeError": {
    "name": "string",
    "message": "string",
    "stack": "string",
    "userFrames": [
      {
        "file": "string",
        "line": 0,
        "column": 0,
        "raw": "string"
      }
    ],
    "userScriptLine": 0,
    "userScriptColumn": 0
  }
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
POST/api/scripts/search

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "http://localhost:3013/api/scripts/search" \  -H "Content-Type: application/json" \  -d '{}'
{
  "results": [
    {
      "name": "string",
      "signature": {
        "kind": "durable",
        "methods": {
          "property1": {
            "argsType": "string",
            "resultType": "string",
            "description": "string"
          },
          "property2": {
            "argsType": "string",
            "resultType": "string",
            "description": "string"
          }
        },
        "argsType": "string",
        "resultType": "string",
        "description": "string"
      },
      "argsJsonSchema": {
        "property1": null,
        "property2": null
      },
      "description": "string",
      "score": 0
    }
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
GET/api/scripts/type-defs

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Response Body

application/json

curl -X GET "http://localhost:3013/api/scripts/type-defs"
{
  "sdkTypes": "string",
  "stdlibTypes": "string"
}
POST/api/scripts/upsert

Authorization

bearerAuth
AuthorizationBearer <token>

API key via Authorization: Bearer <API_KEY>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "http://localhost:3013/api/scripts/upsert" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "source": "string"  }'
{
  "name": "string",
  "version": 0,
  "contentDeduped": true,
  "warnings": [
    "string"
  ]
}
{
  "error": "string",
  "property1": null,
  "property2": null
}
{
  "error": "string",
  "property1": null,
  "property2": null
}