Skip to main content
Glama
MSSQL MCP Server

MSSQL MCP Server

by Elad-Health

get_expensive_queries

Retrieves resource-intensive SQL queries from Query Store or plan cache, sorted by CPU, reads, writes, duration, or executions for performance troubleshooting.

Instructions

Get the most resource-intensive queries from the query store or plan cache

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_expensive_queries"
  }
}

Input Schema

NameRequiredDescriptionDefault
topNoNumber of queries to return
metricNoMetric to sort bycpu
serverNoSQL Server instance (e.g., "server\instance" or "server,port"). Uses default if not specified.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.0

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 full behavioral burden. It usefully discloses that results may come from either the query store or the plan cache, but omits whether query store must be enabled, what permissions are required, whether results are cumulative since last restart, and how the source is chosen when both exist.

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?

A single front-loaded sentence with no filler, which is well matched to a simple three-parameter read tool. The "query store or plan cache" disjunction is slightly vague but does not waste words.

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?

For a low-complexity read tool with all parameters documented in the schema and no output schema, the definition is adequate but thin. The main missing pieces are the fallback behavior when the query store is disabled and the scope of the aggregated statistics, both of which affect interpretation of results.

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%, with top, metric (including its enum and default), and server all documented in the schema. The description adds nothing beyond that baseline other than loosely reinforcing the "most resource-intensive" concept through the metric parameter.

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?

"Get the most resource-intensive queries" pairs a specific verb with a specific resource and adds the data source (query store or plan cache), which separates it from siblings like get_running_queries or get_wait_stats. It stops short of naming an alternative explicitly, so an agent must infer the boundary itself.

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 is only implied: an agent can reason that this fits performance-triage work, but the description never states when to choose it over get_running_queries, get_cpu_usage, or get_wait_stats. There are no exclusions, prerequisites, or notes on when the query store path is unavailable.

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