connect_bpmn_elements
Connect BPMN elements automatically, choosing SequenceFlow, MessageFlow, Association, or DataAssociation based on context. Supports pair, chain, batch, or waypoint modes for flexible diagram wiring.
Instructions
Connect BPMN elements. Supports pair mode (sourceElementId + targetElementId), chain mode (elementIds array for sequential connections), or batch mode (connections array for arbitrary source/target pairs, e.g. a gateway's branches with per-branch conditions). Auto-detects connection type: SequenceFlow for normal flow, MessageFlow for cross-pool, Association for text annotations, and DataAssociation for data objects/stores. Supports optional condition expressions for gateway branches and isDefault flag for gateway default flows. To modify an existing connection's label or condition after creation, use set_bpmn_element_properties with the connection's ID. Also supports waypoint mode: provide connectionId + waypoints to set custom routing on an existing connection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | No | Optional label for the connection | |
| diagramId | Yes | The diagram ID | |
| isDefault | No | When connecting from an exclusive/inclusive gateway, set this flow as the gateway's default flow (taken when no condition matches). | |
| waypoints | No | Ordered array of waypoints defining the connection path (waypoint mode). Must have at least 2 points (start and end). Use with connectionId. | |
| autoLayout | No | When true, run layout_bpmn_diagram automatically after connecting. Useful after the last connection in a sequence. Default: false. | |
| elementIds | No | Ordered list of element IDs to connect sequentially (chain mode). When provided, sourceElementId and targetElementId are ignored. | |
| connections | No | Batch mode — arbitrary source/target pairs (e.g. a gateway's branches), validated up front and applied as one undo step. Each item takes the same fields as pair mode above. | |
| connectionId | No | ID of an existing connection to update waypoints on (waypoint mode). Must be provided together with waypoints. | |
| connectionType | No | Type of connection (default: auto-detected). Usually not needed — the tool auto-detects the correct type. | |
| sourceElementId | No | The ID of the source element (pair mode) | |
| targetElementId | No | The ID of the target element (pair mode) | |
| conditionExpression | No | Optional condition expression for sequence flows leaving gateways (e.g. '${approved == true}') |