Skip to main content
Glama

Create relation

create_relation

Create a directed relation between two existing entities in the world model. Both entities are referenced by UUID; to relate entities by name use relate_entities.

Behavior:
- `relation_type` must be a type from the closed ontology. When none fits,
  use 'related_to' and record the nuance with `store_fact`.
- 'same_as' does not create a relation: it opens a merge proposal for the
  two entities, pending review, and returns its id.
- Rejected with an error: a source or target that does not exist; a
  duplicate (a current relation of the same type between the same two
  entities); a relation from an entity to itself, or one that would close
  a cycle of current relations of the same type (the last two do not
  apply to 'related_to').
- For single-valued relation types, if the source already has a current
  relation of that type to a different target, the new relation is stored
  and a contradiction is opened (see `resolve_contradiction`).

Args:
    source_entity_id: UUID of the source entity.
    target_entity_id: UUID of the target entity.
    relation_type: Relation type from the closed ontology (enum in the
        schema).
    weight: Strength of the relation. Default 1.0.
    causal_probability: Probability (0-1) that the source causes the
        target. Default 0.0.
    properties: Accepts only the keys 'weight' and 'causal_probability'.
        Any other key returns an error and no relation is created;
        store descriptive metadata as a fact with `store_fact`.

Input Schema

NameRequiredDescriptionDefault
weightNo
propertiesNo
relation_typeYes
source_entity_idYes
target_entity_idYes
causal_probabilityNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Far exceeds the annotations (which only give readOnly/destructive/idempotent/openWorld hints). It discloses that 'same_as' opens a pending merge proposal rather than a relation, enumerates four rejection cases (missing entity, duplicate, self-relation, cycle), and explains contradiction-opening behavior for single-valued types.

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?

Front-loaded purpose, then a scannable Behavior bullet list, then Args. Dense and nearly waste-free, though the Args block partially restates schema field names, adding a little redundancy.

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

Completeness5/5

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

For a 6-parameter mutation tool with no output schema, the description covers side effects, error conditions, and the merge-proposal return id, leaving nothing an agent needs to call it correctly unspecified.

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

Parameters5/5

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

Schema coverage is 0%, so the description must carry the load, and it does: source/target are UUIDs, relation_type comes from a closed ontology, weight and causal_probability defaults are given, and the properties key restriction ('only weight and causal_probability, anything else errors') is fully specified.

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 ('Create a directed relation between two existing entities in the world model') and immediately distinguishes itself from the sibling relate_entities by noting the UUID-based vs name-based referencing.

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

Usage Guidelines5/5

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

Explicitly routes the agent: use relate_entities to relate by name, use 'related_to' plus store_fact when no ontology type fits, and uses resolve_contradiction for the single-valued conflict case. Alternatives and conditions are named, not implied.

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.

Resources