Skip to main content
Glama
bpamiri

SQL Server MCP

by bpamiri

execute_query

Run read-only SELECT queries on SQL Server databases to retrieve data with automatic row limits for safety and performance.

Instructions

Execute a read-only SQL query and return results.

Only SELECT statements are allowed. The query will have a row limit applied
automatically if not specified.

Args:
    query: SQL SELECT statement to execute
    max_rows: Maximum rows to return (overrides default, capped by MSSQL_MAX_ROWS)

Returns:
    Dictionary with:
    - query: The original query
    - executed_query: The query that was actually executed (may include TOP)
    - columns: List of column names
    - rows: List of row dictionaries
    - row_count: Number of rows returned
    - max_rows: The effective row limit applied

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
max_rowsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: the tool is read-only (implied by 'execute a read-only SQL query'), applies automatic row limits, caps rows by MSSQL_MAX_ROWS, and returns a structured dictionary. However, it doesn't mention error handling, performance implications, or authentication needs, leaving some gaps.

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?

The description is well-structured and front-loaded with the core purpose, followed by specific details on constraints, parameters, and return values. Every sentence adds value without redundancy, and it efficiently uses bullet points in the Returns section for clarity.

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?

Given the tool's complexity (SQL execution with safety limits) and the presence of an output schema (implied by the detailed Returns section), the description is complete enough. It covers purpose, usage rules, parameter semantics, and return structure, addressing key aspects without needing to repeat schema details.

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?

The schema description coverage is 0%, so the description must compensate. It adds meaningful context for both parameters: 'query' is described as a 'SQL SELECT statement to execute,' and 'max_rows' is explained as overriding the default limit and being capped by MSSQL_MAX_ROWS. This goes beyond the schema's basic type definitions, though it could provide more detail on query syntax or max_rows constraints.

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?

The description clearly states the tool's purpose as executing a read-only SQL query and returning results, specifying 'only SELECT statements are allowed' which distinguishes it from sibling tools like insert_row, update_row, or delete_row that perform write operations. It uses specific verbs ('execute', 'return') and identifies the resource (SQL query).

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

Usage Guidelines5/5

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

The description explicitly states 'Only SELECT statements are allowed,' providing clear guidance on when to use this tool versus alternatives like insert_row or update_row for write operations. It also mentions that 'The query will have a row limit applied automatically if not specified,' indicating usage context for result size management.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bpamiri/pymssql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server