Skip to main content
Glama
MSSQL MCP Server

MSSQL MCP Server

by Elad-Health

execute_query

Run read-only SELECT queries against Microsoft SQL Server to retrieve data for schema discovery, performance checks, and troubleshooting, with optional server/database targeting and row limits.

Instructions

Execute a read-only SQL query. Only SELECT statements are allowed for safety.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "execute_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe SQL SELECT query to execute
serverNoSQL Server instance (e.g., "server\instance" or "server,port"). Uses default if not specified.
maxRowsNoMaximum rows to return (default: 1000)
databaseNoDatabase to run the query against (optional, uses default if not specified)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.0

TDQS

B3.2/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden, and it only discloses the SELECT-only safety gate. It says nothing about execution limits (timeout, query cost cap), whether the maxRows default is enforced server-side or truncates silently, what an error looks like when a non-SELECT statement is rejected, or how permissions failures surface. The disclosed constraint is genuinely useful, but for a mutation-adjacent, arbitrary-code-execution tool the disclosure is thin.

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 and immediately followed by the safety constraint. There is no filler and no repetition of the schema.

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

Completeness2/5

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

There is no output schema, so the description is the only place return behavior could be described, and it is silent on whether results come back as rows/objects, whether maxRows truncation is flagged, or what happens on rejection or error. For a tool that runs arbitrary SQL against a named server and database, the omission of result shape and failure semantics leaves a real gap.

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 four parameters (query, server, maxRows, database) are already documented with examples and defaults. The description adds no parameter-level meaning beyond restating that the query must be a SELECT. This is the baseline-3 case where the schema does the heavy lifting.

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 definition pairs a specific verb (Execute) with a specific resource (a SQL query) and immediately bounds it: 'read-only ... Only SELECT statements are allowed.' That cleanly separates it from the get_*/list_* siblings, which are fixed-shape status and metadata reads. It stops short of a 5 because it never says what the tool returns (a result set, rows, columns) or names the ad-hoc-vs-predefined distinction explicitly.

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?

'Only SELECT statements are allowed for safety' is a constraint rather than routing guidance, but it does imply this is the tool for ad-hoc read queries while the get_* siblings cover canned inspections. There is no explicit statement of when to prefer a predefined sibling (e.g., use get_tables instead of SELECT from sys.tables) and no prerequisites such as required permissions.

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