Create a relationship
create_relationshipAssert that two addresses name the same thing, or record a rejected candidate with a reason. Each end is an address — an entity and a path — and the two ends may sit in different datasources and answer in different shapes: a campaign identifier in a warehouse column and a campaign identifier inside a service's document are one relationship between two addresses. A foreign key is one instance of the same form, both ends in one datasource with a column's name as its path. Where both ends answer in rows in the same datasource the join is measured and its cardinality derived from source uniqueness: a declared key, or, on a table that declares none, values measured non-null and distinct against a unique target. A conflicting assertion is refused, except that N:1 may be stated where only measurement makes the source unique. If either column's values are withheld, nothing is joined and a stated cardinality is recorded as an unvalidated assertion; anywhere else nothing is joined, the relationship is recorded as asserted rather than validated, and the cardinality is the one you state. Calling this for a listed candidate that already has an unanswered relationship row confirms or rejects that row in place; a relationship that already carries an answer is changed with update_relationship using the returned relationship_id.
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": {
"source": "<source>",
"target": "<target>"
},
"name": "create_relationship"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | The first end: {entity, path, datasource_id?}. Entity to address: a table of rows or a document, named `schema.entity` (for example 'google_ads.campaign_status') or by its bare name when that is unambiguous in the datasource. Path to one field of that entity. For an entity that answers in rows this is a column's name ('status'); for one that answers with a document it is the projection path ('campaign.status', 'result.homes[].price'), and a path ending in '*' is an open region, classified as a unit. datasource_id defaults to the datasource this call targets. | |
| target | Yes | The second end, in the same form. Name datasource_id here to relate an address in another datasource. | |
| rejected | No | Record a considered rejection. True requires rejection_reason; false confirms using measured join statistics. | |
| datasource | No | Optional datasource ID to target. Omit to use the project's configured default; required when the project has multiple datasources and no default is configured. Each datasource has its own SQL dialect: get_schema lists every datasource with its type, dialect and identifier quote, and every result carries datasource_type and dialect. A datasource that has not finished setup is refused with datasource_not_ready. | |
| cardinality | No | Optional cardinality assertion (1:1 or N:1), which must match the measured result; N:1 is also accepted where only measured uniqueness, not a declared key, makes it 1:1. | |
| rejection_reason | No | Reason for rejecting the candidate; requires an explicit rejection. |