Skip to main content
Glama

analyze_relationships

Read-only

Maps how collections relate across your Directus instance, showing which fields link them and their relationship type. Use it before creating, changing, or deleting fields and collections.

Instructions

Maps relationships across the instance: which collections point at which, through which fields, and of which type (o2o, o2m, m2o, m2m, m2a). Pass collection to narrow it to one collection and its neighbours, or omit it for the whole graph. Use it before create_relationship, before deleting a field or collection, or when a nested query returns an unexpected shape; analyze_collection_schema covers one collection in depth. Read-only, and it reads the data model only, never items. System collections are excluded unless includeSystemCollections is true.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "analyze_relationships"
  }
}

Input Schema

NameRequiredDescriptionDefault
collectionNoSpecific collection to analyze
includeSystemCollectionsNoInclude system collections

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv12.3.3

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, and the description reinforces this with "Read-only, and it reads the data model only, never items" — a meaningful clarification that no data is mutated or read. It also discloses the system-collection exclusion rule, which is behavioral rather than schema-level. It does not describe the shape or volume of the returned map, so a small gap remains.

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

Conciseness5/5

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

Front-loads the core behavior, then scope, then usage triggers, then safety and limits. Every sentence carries distinct information — no restating of the title or name, no filler.

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

Completeness4/5

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

There is no output schema, so the description is the only source for what a caller gets back, and it names the categories of information returned (collections, fields, relationship types) but not the actual result structure or granularity. For a read-only two-parameter analysis tool with clear usage routing, this is nearly complete, with only return-shape detail missing.

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

Parameters4/5

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

Schema coverage is 100%, so baseline is 3, but the description adds real meaning: "collection" scopes the result to one collection *and its neighbours* (not just that collection), and omitting it yields the whole graph. It also clarifies that includeSystemCollections defaults to exclusion, which the terse schema string does not convey.

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 ("Maps relationships") plus the exact resource and output content: which collections point at which, through which fields, and the relationship types (o2o, o2m, m2o, m2m, m2a). It also explicitly carves out the sibling boundary: "analyze_collection_schema covers one collection in depth," so an agent can choose between them without opening either schema.

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?

Gives concrete triggering conditions (before create_relationship, before deleting a field or collection, when a nested query returns an unexpected shape) and names the alternative tool plus the condition that selects it. Both the when and the when-not are present.

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