Skip to main content
Glama

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

NameRequiredDescriptionDefault
idYesUnique ID of the relation
labelNo
onDeleteNo
onUpdateNo
toCellIdYesID of the target entity
toFieldIdYesID of the target field (typically the PK)
fromCellIdYesID of the source entity (FK side)
fromFieldIdYesID of the FK field (must be of type reference)
cardinalityToYesCardinality on the target side
cardinalityFromYesCardinality on the source side
expectedProjectIdNoUUID of the project THIS call targets (overrides the session project).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / expectedProjectId / description
      Previous value: -"UUID of the project THIS call targets (overrides the session project). No access: refused, nothing changed."New value: +"UUID of the project THIS call targets (overrides the session project)."
  2. Changed1 schema field changed
    • changedInput schema / properties / expectedProjectId / description
      Previous value: -"UUID of the project targeted by THIS call. ACTUALLY targets this project instead of the session project. Refused without changing anything if access is not granted."New value: +"UUID of the project THIS call targets (overrides the session project). No access: refused, nothing changed."
  3. Changed8 schema fields changed
    • changedInput schema / properties / cardinalityFrom / description
      Previous value: -"Cardinalité côté source"New value: +"Cardinality on the source side"
    • changedInput schema / properties / cardinalityTo / description
      Previous value: -"Cardinalité côté cible"New value: +"Cardinality on the target side"
    • changedInput schema / properties / expectedProjectId / description
      Previous value: -"UUID du projet visé par CET appel. Cible RÉELLEMENT ce projet au lieu du projet de session. Refusé sans rien modifier si l'accès n'est pas accordé."New value: +"UUID of the project targeted by THIS call. ACTUALLY targets this project instead of the session project. Refused without changing anything if access is not granted."
    • changedInput schema / properties / fromCellId / description
      Previous value: -"ID de l'entité source (côté FK)"New value: +"ID of the source entity (FK side)"
    • changedInput schema / properties / fromFieldId / description
      Previous value: -"ID du champ FK (doit être de type reference)"New value: +"ID of the FK field (must be of type reference)"
    • changedInput schema / properties / id / description
      Previous value: -"ID unique de la relation"New value: +"Unique ID of the relation"
    • changedInput schema / properties / toCellId / description
      Previous value: -"ID de l'entité cible"New value: +"ID of the target entity"
    • changedInput schema / properties / toFieldId / description
      Previous value: -"ID du champ cible (typiquement la PK)"New value: +"ID of the target field (typically the PK)"
  4. First observed

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already disclose mutation-without-destruction and closed-world scope, so the bar is lower. The description adds useful constraints (source field type, cardinality placement) but says nothing about onDelete/onUpdate cascade behavior, which is the most consequential setting in a relation-creation call, and its 'by default' cardinality claim is confusing since both cardinality parameters are required in the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four short sentences, front-loaded with the core action and ending with the sibling redirect placed for emphasis. The phrasing is efficient; the 'by default' cardinality aside is the one piece that costs clarity rather than earning space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 11-parameter mutation tool with no output schema, the description covers the shape of the call but omits referential-action semantics (onDelete/onUpdate), what a successful response contains, and any permission or project-scoping notes. Adequate to invoke, incomplete for invoking correctly in edge cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 73%, so the schema carries most of the load. The description explains crow's-foot cardinality conceptually and which side is the FK, which adds real meaning beyond the bare enums, but it does not clarify id generation, label, or the referential-action parameters, and it repeats the 'must be of type reference' note already present in the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Creates ONE relation between two entities') and emphasizes the singularity of the operation, which directly distinguishes it from the batch sibling. An agent can tell from the first sentence that this is the single-relation path.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes multi-relation work to `add_relations_batch` and states the precondition that the source field must be of type 'reference'. It stops short of covering the other relatives (update_relation, delete_relation) or saying when not to create a relation at all, but the primary branching decision is made for the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.