Skip to main content
Glama
shadow-dba

mssql-dba-mcp

by shadow-dba

Run SELECT Query

mssql_run_select
Read-onlyIdempotent

Run one read-only SELECT or WITH query for ad-hoc DBA analysis of system views and DMVs; writes are rejected and results are capped at 500 rows. Use databaseName to query another database.

Instructions

Run one read-only SELECT (or WITH ... SELECT) query: ad-hoc analysis of system views and DMVs when no other tool fits. One statement only; INSERT, UPDATE, EXEC, SET, USE, SELECT INTO and anything else that writes or changes the session are rejected. Use databaseName instead of USE to run in another database. Returns at most 500 rows; add TOP, WHERE or GROUP BY to narrow.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectQueryYesOne read-only SELECT statement, for example: SELECT TOP (10) name, create_date FROM sys.tables ORDER BY create_date DESC
databaseNameNoDatabase to run the query in. Defaults to the connected database (DB_NAME).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description adds real operational context beyond them: exactly one statement, a list of rejected keywords (INSERT, UPDATE, EXEC, SET, USE, SELECT INTO), session-change prohibition, and a hard 500-row return cap with mitigation advice.

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?

Three tight sentences, front-loaded with the core capability, then the constraint set, then the return-limit workaround. No filler; every clause carries either a rule or a routing cue.

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

Completeness5/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 still covers the essentials an agent needs: what is accepted, what is rejected, how to target another database, and the 500-row result ceiling. Nothing material is left unstated for a query-execution tool.

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 coverage is 100%, so the baseline is 3; the description adds value by explaining the intent behind databaseName ('instead of USE to run in another database'), which clarifies why the parameter exists rather than just what it is. It does not add syntax details for selectQuery beyond the schema's own example.

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?

States a specific verb (run) and resource (one read-only SELECT / WITH...SELECT) plus its scope: ad-hoc analysis of system views and DMVs. It also positions itself against siblings with 'when no other tool fits', so an agent can tell it apart from the ~40 specialized mssql_* tools without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear context for use ('ad-hoc analysis of system views and DMVs when no other tool fits') and an explicit alternative for one case ('use databaseName instead of USE'). It stops short of naming any concrete sibling (e.g. mssql_top_queries), so the routing guidance remains general rather than exhaustive.

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