Skip to main content
Glama
Andrian17

mssql-mcp-server

by Andrian17

mssql_manage_constraints

List, create, and drop SQL Server constraints and foreign keys using operations for get, create_fk, drop_fk, create, and drop.

Instructions

Manage SQL Server constraints - get, create foreign keys, drop foreign keys, create constraints, drop constraints. Examples: operation="get" to list constraints, operation="create_fk" with constraintName, tableName, columnNames, referencedTable, referencedColumns

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNoSchema name (defaults to dbo)
cascadeNoAccepted for compatibility; SQL Server DROP CONSTRAINT has no CASCADE
ifExistsNoInclude IF EXISTS clause (for drop_fk/drop operations)
onDeleteNoON DELETE action (for create_fk); RESTRICT maps to NO ACTIONNO ACTION
onUpdateNoON UPDATE action (for create_fk); RESTRICT maps to NO ACTIONNO ACTION
clusteredNoCLUSTERED index for primary_key (default true) / unique (default false)
operationYesOperation: get (list constraints), create_fk (foreign key), drop_fk (drop foreign key), create (constraint), drop (constraint)
tableNameNoTable name (optional filter for get, required for create_fk/drop_fk/create/drop)
deferrableNoNot supported by SQL Server; true is rejected
columnNamesNoColumn names in the table (required for create_fk and unique/primary_key create)
constraintNameNoConstraint name (required for create_fk/drop_fk/create/drop)
constraintTypeNoFilter by constraint type (for get operation)
checkExpressionNoCheck expression (for create operation with check constraints)
referencedTableNoReferenced table name (required for create_fk)
connectionStringNoSQL Server connection string (optional; requires --allow-tool-connection-string)
referencedSchemaNoReferenced table schema (for create_fk, defaults to same as table schema)
initiallyDeferredNoNot supported by SQL Server; true is rejected
referencedColumnsNoReferenced column names (required for create_fk)
constraintTypeCreateNoType of constraint to create (for create operation)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A3.5/5.0
Behavior3/5

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

No annotations are provided, so the description and schema carry the full behavioral burden. The description does disclose the operation set, and the schema documents several genuine behavioral traits: CASCADE is accepted but ignored, RESTRICT maps to NO ACTION, deferrable/initiallyDeferred are rejected with true, and clustered defaults differ per constraint type. However, tool-level effects such as the irreversibility of drop operations, transaction/commit behavior, and what the get operation returns are left undisclosed.

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?

Two sentences with no filler; the operation enumeration is front-loaded and the example sentence carries dense invocation knowledge. The dash-heavy structure is slightly crammed and would scan better as a list, but every phrase earns its place.

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

Completeness3/5

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

Given the high complexity (19 parameters, 5 operations, destructive DDL, no annotations, no output schema), the definition is adequate but gapped. The schema descriptions cover per-parameter requirements for every operation, which compensates substantially. But the tool-level description omits return semantics for get, provides no warning about the referential-integrity impact of drops despite having no safety annotations, and only exemplifies two of five operations.

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 description coverage is 100%, establishing a baseline of 3. The description adds co-occurrence semantics above that baseline: the create_fk example binds constraintName, tableName, columnNames, referencedTable, and referencedColumns into a single valid parameter group, which is relational knowledge a flat schema does not directly convey. It loses a point because only two of the five operations get such grouping examples.

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 names a specific resource ('SQL Server constraints') and enumerates the five supported operations (get, create_fk, drop_fk, create, drop) followed by worked examples. This makes the tool clearly distinct from constraint-adjacent siblings like mssql_manage_indexes. It loses the top mark because the verb 'manage' is broad and the opening clause partially restates the tool's own name without naming what the tool is not.

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?

Usage context is implied rather than stated: the constraint-specific resource and the per-operation examples suggest when to invoke it, and the sibling set (mssql_manage_indexes, mssql_manage_triggers, mssql_manage_schema) makes the division of labor inferable. However, there is no explicit statement of when to use this tool versus alternatives, no exclusion criteria, and no guidance on how it composes with mssql_execute_query or mssql_analyze_database.

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