add_relation
Creates ONE relation between two entities. The source field has to be of type 'reference'. The cardinality (crow's foot) is specified on each end — by default 'many' on the FK side, 'one' on the target side. Several relations: add_relations_batch places them in 1 call.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>",
"fromCellId": "<fromCellId>",
"fromFieldId": "<fromFieldId>",
"toCellId": "<toCellId>",
"toFieldId": "<toFieldId>",
"cardinalityFrom": "<cardinalityFrom>",
"cardinalityTo": "<cardinalityTo>"
},
"name": "add_relation"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Unique ID of the relation | |
| label | No | ||
| onDelete | No | ||
| onUpdate | No | ||
| toCellId | Yes | ID of the target entity | |
| toFieldId | Yes | ID of the target field (typically the PK) | |
| fromCellId | Yes | ID of the source entity (FK side) | |
| fromFieldId | Yes | ID of the FK field (must be of type reference) | |
| cardinalityTo | Yes | Cardinality on the target side | |
| cardinalityFrom | Yes | Cardinality on the source side | |
| expectedProjectId | No | UUID of the project THIS call targets (overrides the session project). |