Skip to main content
Glama

create_relationship

Create relationships between Directus collections—one-to-one, one-to-many, many-to-one, many-to-many, and many-to-any—by specifying source, field, and target. Configure delete/update actions and junction fields for precise data modeling.

Instructions

Create relationships between collections (O2O, O2M, M2O, M2M, M2A)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesRelationship type
fieldYesSource field
on_deleteNoOn delete action
on_updateNoOn update action
collectionYesSource collection
sort_fieldNoSort field
related_fieldNoTarget field
junction_fieldNoJunction field (M2M only)
collection_fieldNoCollection field (M2A only)
primary_key_fieldNoPrimary key field (M2A only)
related_collectionNoTarget collection
allowed_collectionsNoAllowed collections (M2A only)
junction_collectionNoJunction collection (M2M only)
related_junction_fieldNoRelated junction field (M2M only)
Behavior2/5

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

Annotations (readOnlyHint=false, destructiveHint=false, openWorldHint=true) already establish this as a mutating but non-destructive operation, and the description is consistent with them — no contradiction. However, the description adds no behavioral context beyond that: no mention of auto-created junction collections for M2M, effects on existing data, validation requirements, or failure modes. It merely restates the relationship-type enum already present 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?

The description is a single tightly structured sentence with the verb front-loaded and the relationship types in a scannable parenthetical. It loses one point because the parenthetical repeats the schema's already-documented enum values, making a small portion of the text redundant rather than adding information.

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

Completeness2/5

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

This is a 14-parameter tool with five distinct modes, each requiring different parameter subsets (junction fields for M2M, allowed_collections/collection_field/primary_key_field for M2A), and no output schema. A single sentence does not explain which parameters apply to which mode, prerequisites, or side effects. An agent would need deep schema inspection and external knowledge to configure a correct call, so the description is inadequate for the tool's complexity.

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 description coverage is 100%, so all 14 parameters are documented in the schema itself, earning the baseline of 3. The description adds no meaning beyond the schema — the (O2O, O2M, M2O, M2M, M2A) list merely duplicates the 'type' enum — and it does not explain how parameters interact per relationship type, such as which fields are required for M2M vs M2A.

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

Purpose4/5

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

The description states a specific verb ('Create') and resource ('relationships between collections') and enumerates the five supported relationship types, which clearly separates it from siblings like create_collection, create_item, and create_field. It stops short of a 5 because it doesn't explicitly contrast itself with related tools like analyze_relationships or update_field, which also touch relationships.

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

Usage Guidelines2/5

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

No guidance is given on when to use this tool versus alternatives. It doesn't mention that analyze_relationships is for inspecting existing relationships, that update_field handles schema modifications, that prerequisites (existing collections) may apply, or any exclusions. The type list implies broad coverage but gives an agent no routing conditions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/staminna/mcp-server-claude'

If you have feedback or need assistance with the MCP directory API, please join our Discord server