Skip to main content
Glama

validate_fk_integrity

Check a table's foreign keys to find orphan child rows missing their parent. Returns constraint details and orphan counts; an empty result means referential integrity holds.

Instructions

Check one or all foreign keys of a table and report orphan rows (child rows whose parent is missing). Returns one entry per FK with constraint name, child/parent columns and the orphan count; an empty list means referential integrity is intact.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableYesTable name.
schemaNoSchema (owner) of the table. Optional — defaults to the server's current schema; omit rather than guess.
constraintNoOptional constraint-name filter; omit to check every FK on the table.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.16.3

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does well: it discloses the return shape (one entry per FK, constraint name, child/parent columns, orphan count) and the empty-list meaning. It omits any note on read-only safety, permissions, or cost when scanning large tables.

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?

Two sentences, front-loaded with the action, then the return contract. No filler, and the empty-list semantics are packed into the same sentence efficiently.

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?

No output schema exists, so the description must describe returns, and it does so adequately. It is nearly complete for a 3-param validation tool, missing only error behavior and performance expectations on large tables.

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 three parameters are already documented. The description's 'one or all foreign keys'/'omit' phrasing only echoes the schema's meaning without adding format or syntax detail, so baseline 3 applies.

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+resource ('Check ... foreign keys of a table') and the exact outcome ('report orphan rows'). The orphan-detection framing cleanly distinguishes it from siblings like list_constraints and get_fk_graph.

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

Usage Guidelines3/5

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

'Check one or all foreign keys' plus the 'omit to check every FK' note implies the scope choice, but there is no explicit when-to-use guidance or named alternative (e.g. vs get_fk_graph or list_constraints). Usage is inferable only.

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