add_bpmn_elements
Add tasks, gateways, or events to a BPMN diagram. Connect them in a chain with automatic layout, or place them at specific anchors, lanes, or flows.
Instructions
Add one or more elements (tasks, gateways, events, etc.) to a BPMN diagram; a single element is an array of one. With connect "chain" (default) each element is connected to the previous one by a sequence flow (afterElementId attaches the first one after an existing element) and the diagram is laid out; with connect "none" they are only added, each placed right of the previous one. Chains containing a gateway are not auto-connected past it — wire branches with connect_bpmn_elements. An entry that sets its own anchor or position (hostElementId, flowId, fromElementId + toLaneId, copyFrom, afterElementId, x/y) is placed there instead of being chained, and then auto-layout is off unless autoLayout is true. Supports boundary events via hostElementId, inserting into a flow via flowId, and cross-lane handoff via fromElementId + toLaneId. Subprocesses are expanded by default (isExpanded=false for collapsed). Generates descriptive element IDs when a name is provided (e.g. UserTask_EnterName). See bpmn://guides/modeling-elements for naming conventions, integration patterns, and event subprocess guidance.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| laneId | No | Default lane for all entries; overridable per entry. | |
| connect | No | "chain" (default) connects each element to the previous one; "none" only adds them, placing each right of the previous one (starting from afterElementId) unless it sets its own anchor/position. | chain |
| elements | Yes | Elements to add, in order. participantId, laneId and afterElementId at the top level apply to all entries. | |
| diagramId | Yes | The diagram ID returned from create_bpmn_diagram | |
| autoLayout | No | Run layout_bpmn_diagram afterwards (chain mode only; default true, but off when a gateway is in the chain or an entry sets its own anchor/position). | |
| participantId | No | Default participant (pool) for all entries; overridable per entry. | |
| afterElementId | No | Attach the first element after this existing element (auto-positioned). |