Skip to main content
Glama

dq_check_relationship

Read-onlyIdempotent

Validate join relationships before relying on them by detecting orphaned child keys, NULL foreign keys, and non-unique parent keys that cause dropped rows or inflated totals.

Instructions

Test a join before trusting it: orphaned child keys (rows an INNER JOIN silently drops), NULL foreign keys, and a non-unique parent key (which makes a LEFT JOIN fan out and inflate totals).

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": {
      "child_table": "<child_table>",
      "child_key": "<child_key>",
      "parent_table": "<parent_table>",
      "parent_key": "<parent_key>"
    },
    "name": "dq_check_relationship"
  }
}

Input Schema

NameRequiredDescriptionDefault
sampleNo
child_keyYesForeign key column in the child table, e.g. orders.customer_id.
parent_keyYesKey column in the parent table, e.g. customers.customer_id.
child_tableYesTable name from dq_list_sources, e.g. 'orders' or 'warehouse.main.orders'.
parent_tableYesTable name from dq_list_sources, e.g. 'orders' or 'warehouse.main.orders'.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, closed-world behavior, so safety is covered. The description earns credit by explaining the consequence of each defect — INNER JOIN silently dropping rows and LEFT JOIN fan-out inflating totals — which is genuine context beyond the annotations. It does not mention cost, limits, or that the sample parameter bounds scan size.

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?

A single front-loaded sentence with the purpose stated first and the parenthetical justifications for each check compactly embedded. No filler or repetition of the tool name.

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?

An output schema exists and rich annotations are supplied, so the description needn't explain return values. It covers what the check tests and why it matters for a five-parameter tool. The only minor gap is that it doesn't hint at what the 'sample' parameter affects.

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 80%, so the schema already documents child_table, child_key, parent_table, and parent_key with examples. The description adds no syntax or format detail beyond what the schema provides; its mention of orphan/NULL/fan-out maps only conceptually onto the key parameters. Baseline 3 is appropriate.

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?

Specific verb (test) plus resource (join/relationship) with an explicit enumeration of the three failure modes checked: orphaned child keys, NULL foreign keys, and non-unique parent keys. An agent can tell this apart from dq_check_nulls or dq_check_duplicates, which check single-table issues rather than cross-table key integrity.

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?

The opening clause 'Test a join before trusting it' gives a clear trigger context — use before relying on a join. It does not name an alternative tool or state when not to use this one, so it falls short of the explicit routing a 5 requires.

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