Skip to main content
Glama
shadow-dba

mssql-dba-mcp

by shadow-dba

Get DB Foreign Keys

mssql_db_foreign_keys
Read-onlyIdempotent

Review SQL Server foreign keys for untrusted, disabled, unindexed, or type/collation mismatch issues, suggest WITH CHECK CHECK CONSTRAINT fixes, and flag likely missing foreign keys by column name.

Instructions

Foreign keys review for one database: each foreign key with trusted, disabled, indexed (unindexed foreign keys slow joins and deletes) and column type or collation mismatches, plus the WITH CHECK CHECK CONSTRAINT fix; and likely missing foreign keys found by column name (for example Votes.PostId -> Posts.Id). Name matching is a guess, so confirm each one.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
onlyIssuesNoList only existing foreign keys that have an issue. Defaults to false (all).
databaseNameNoTarget database. Defaults to connected database.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnlyHint, idempotentHint, destructiveHint=false), so the bar is lower, and the description adds real context: what issues are detected, that a fix statement is surfaced, and a caveat that missing-FK name matches are speculative and must be confirmed. The one ambiguity is whether the 'WITH CHECK CHECK CONSTRAINT fix' is returned as a script or applied, though readOnlyHint implies it is only surfaced — short of a contradiction.

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 content is front-loaded and every clause carries information, but it is delivered as a single dense, heavily parenthesized sentence, which makes the fix and guess caveats slightly harder to scan than a clean bulleted breakdown would be.

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?

With no output schema, the description does the work of describing return content (per-FK trusted/disabled/indexed/mismatch status plus suggested missing FKs), which is sufficient for an agent to know what it will get. It is nearly complete for a read-only diagnostic; the only minor gap is not clarifying whether the fix is a script or an action.

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 both parameters (onlyIssues, databaseName) are already fully documented in the schema. The description alludes to issue-only filtering but adds no syntax, defaults, or format detail beyond what the schema provides, making the 3 baseline correct.

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?

The description states a specific resource (foreign keys in one database) and enumerates exactly what the review surfaces: trusted/disabled state, indexing, column type or collation mismatches, the WITH CHECK CHECK CONSTRAINT fix, and likely missing foreign keys. It is clearly distinguishable from siblings like mssql_db_table_keys and mssql_db_check_constraints, while the example 'Votes.PostId -> Posts.Id' pins down the missing-FK heuristic.

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?

The scope is strongly implied (use this to review FK integrity and to spot missing FKs for a database), and it gives one piece of usage guidance — name matching is a guess, so confirm each hit. However, it names no alternatives and gives no explicit when-not-to-use conditions versus tools such as mssql_db_table_keys or mssql_db_column_design_issues, so guidance remains inferred.

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