# exo_activate_flow

> Documentation index: https://exomations.com/llms.txt

Switch on a flow in staging, after the same checks as the app.

Runs the same activation checks as the app (connections, error handling, trigger and structure) and activates the flow in **staging**. It never touches production: a flow whose environment is production is refused. A flow in development is moved to staging. New flows are created with production as their environment, so a person first moves a flow to staging in the app. On a flow that is already active in staging it changes nothing.

Before it activates a flow, it also checks that flow and the flows it runs as sub-flows (up to six levels deep). It refuses when any of them runs a Nafath, Muqeem or Tamm government step withheld from AI clients, has a sub-flow step without a fixed target flow (including one an AI agent would fill in at run time), or has a step with two conflicting step types, and when the sub-flows go deeper than six levels. A person activates such a flow in the app.

Once active, the flow is also offered as a flow tool to keys with `execute`; its runs carry the environment `staging`.

Permission: `build`.

## Input

| Name | Type | Required | Description |
|---|---|---|---|
| `flowId` | string | yes | The tenant-owned flow id to activate in staging. |
| `environment` | string ("staging") | no | Optional explicit environment. Only staging is accepted. |

## Returns

`activated: true`, `flowId`, `status: "active"`, `environment: "staging"`, `productionPromoted: false`, `lintWarnings` and `repairNotes`. When the checks fail: `activated: false` and `gateFailures`, with `isError: true`.

## Errors

- Tool result with `isError: true`: ``flowId` is required.`
- Tool result with `isError: true`: `MCP activation is staging-only. Production promotion must be performed by a human in Exomations.`
- Tool result with `isError: true`: `Flow "<flowId>" not found.`
- Tool result with `isError: true`: `This flow is currently in production. MCP cannot demote or alter a production flow; create or switch to a staging draft first.`
- Tool result with `isError: true`: `Flow "<name>" was NOT activated: it runs a Nafath, Muqeem or Tamm government step that is withheld from AI clients, directly or through a sub-flow. Activate it in the Exomations app.`
- Tool result with `isError: true`: `Flow "<name>" was NOT activated: a sub-flow step in it (or in a flow it runs) has no fixed target flow, so its target is chosen at run time and cannot be checked here. Activate it in the Exomations app.`
- Tool result with `isError: true`: `Flow "<name>" was NOT activated: a step in it (or in a flow it runs) carries two different step types, so it cannot be checked here. Activate it in the Exomations app.`
- Tool result with `isError: true`: `Flow "<name>" was NOT activated: it runs sub-flows nested deeper than can be checked here. Activate it in the Exomations app.`
- Tool result with `isError: true`: `Flow "<name>" was NOT activated: the workspace's flows could not be read to check it. Activate it in the Exomations app.`
- Tool result with `isError: true`: `Flow NOT activated — the shared activation quality gate found <n> blocking issue(s): <issues>`
- Tool result with `isError: true`: `Activation failed before the flow was saved.`
- Tool result with `isError: true`: `Flow "<name>" was not activated because its schedule could not be registered: <reason>`
- JSON-RPC -32001 (HTTP 403): `API key lacks the 'build' permission required for flow authoring tools`

## Example call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "exo_activate_flow",
    "arguments": {
      "flowId": "7a17617d-3c4e-4f0a-9b1e-2d5c8e0f4a61"
    }
  }
}
```

## Example result

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Flow \"Overdue invoice reminders\" activated in STAGING. Production promotion was not changed.\n{ ... }"
      }
    ],
    "structuredContent": {
      "activated": true,
      "flowId": "7a17617d-3c4e-4f0a-9b1e-2d5c8e0f4a61",
      "status": "active",
      "environment": "staging",
      "productionPromoted": false,
      "lintWarnings": [],
      "repairNotes": []
    },
    "isError": false
  }
}
```
