Skip to main content
Glama
Andrian17

mssql-mcp-server

by Andrian17

mssql_manage_query

Analyze SQL Server query performance: explain execution plans, retrieve slow queries or query statistics, and reset plan cache/Query Store stats.

Instructions

Manage SQL Server query analysis and performance - operation="explain" for execution plans, operation="get_slow_queries" for slow query analysis (Query Store or plan cache), operation="get_stats" for query statistics, operation="reset_stats" for clearing statistics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
costsNoAccepted for compatibility; ignored
limitNoNumber of queries to return (for get_slow_queries/get_stats operations)
queryNoSQL query to explain (required for explain operation)
formatNoOutput format (for explain operation); json = XML plan plus extracted metricsjson
analyzeNoActual plan (SET STATISTICS XML) - executes the query (for explain operation)
buffersNoAccepted for compatibility; ignored
orderByNoSort order (for get_slow_queries and get_stats operations)mean_time
queryIdNoSpecific query ID (Query Store query_id) or 0x plan_handle (plan cache) to reset; resets all if not provided
verboseNoAccepted for compatibility; ignored
minCallsNoMinimum number of calls (for get_stats operation)
operationYesOperation: explain (estimated or actual execution plan), get_slow_queries, get_stats (with cache hit ratios), reset_stats (clear plan cache / Query Store stats)
minDurationNoMinimum average duration in milliseconds (for get_slow_queries operation)
queryPatternNoFilter queries containing this pattern (for get_stats operation)
connectionStringNoSQL Server connection string (optional; requires --allow-tool-connection-string)
includeNormalizedNoAccepted for compatibility; ignored

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the behavioral disclosure burden. It does state what each operation does, including that reset_stats clears statistics, which hints at mutating behavior. But it does not warn that reset_stats is destructive, that explain with analyze=true executes the query, or that some operations may require elevated permissions.

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 description is a single dense sentence that front-loads the tool's purpose and then lists all four operations with their purposes. It wastes no words, though the long dash-separated enumeration could benefit from a more structured format for readability.

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?

The description gives a sufficient high-level operation map for a 15-parameter dispatcher tool, and the rich schema fills in most invocation details. It lacks guidance on output shape, side effects, connection requirements, and when to choose this tool over database-level analysis tools, so it is complete enough only in combination with the schema.

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 the input schema already documents every parameter, including enums, defaults, and operation-specific applicability. The tool description adds no parameter-level detail, which is acceptable given the strong schema coverage.

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 clearly maps the tool to SQL Server query analysis and performance and enumerates four concrete operations: explain, get_slow_queries, get_stats, and reset_stats. It is much more specific than a mere restatement of the tool name, though it does not explicitly differentiate it from overlapping siblings like mssql_analyze_database or mssql_monitor_database.

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?

Each operation has an implied use case ('operation="explain" for execution plans', 'operation="get_slow_queries" for slow query analysis'), which gives reasonable context. However, there is no explicit guidance about when to use this tool instead of related siblings, nor any when-not-to-use or exclusion notes.

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