Skip to main content
Glama
bymcs

MS SQL Server MCP Server

by bymcs

Run SQL Query

mssql_run_sql_query

Execute any SQL statement on the connected MS SQL Server, using named parameters for secure, injection-resistant queries and selectable JSON or Markdown output for flexible results.

Instructions

Executes an arbitrary SQL statement against the connected database. ⚠️ WARNING: This tool can read AND modify data (INSERT, UPDATE, DELETE, DDL). Always prefer parameterized inputs via the 'parameters' field — never embed user-supplied values directly in the query string. Example: query='SELECT * FROM dbo.Users WHERE Id = @id', parameters={id: 42}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSQL statement to execute
parametersNoNamed parameters referenced in the query via @paramName
response_formatNoOutput format: 'json' for structured data, 'markdown' for human-readable tablejson
Behavior4/5

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

Annotations already indicate readOnlyHint=false, openWorldHint=true, and idempotentHint=false. The description adds meaningful behavioral context by explicitly warning that the tool can read AND modify data, listing INSERT, UPDATE, DELETE, and DDL as examples, and urging parameterized inputs to prevent injection. This goes beyond the annotation metadata.

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 appropriately sized, front-loaded with the core purpose, and every sentence earns its place. The warning and example are directly useful, and there is no redundant filler.

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

Completeness4/5

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

Given the tool's arbitrary SQL execution nature and the absence of an output schema, the description covers the most critical aspects: it warns about data modification and demonstrates safe parameter usage. It does not describe return formats or error behavior in detail, but the response_format parameter partially addresses output expectations.

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 already provides 100% coverage for all parameters, so the baseline is 3. The description adds value by including a concrete example showing the '@paramName' syntax and emphasizing the security rationale for using the 'parameters' field, which goes beyond the schema descriptions.

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 states the tool executes an arbitrary SQL statement against the connected database, which is a specific verb+resource pairing. It is clear but does not explicitly differentiate itself from sibling tools like mssql_execute_query, so it does not fully achieve the highest score.

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?

The description provides strong security guidance about parameterized inputs and avoiding SQL injection, but it does not explicitly state when to use this tool versus alternatives such as mssql_get_table_data or mssql_execute_stored_procedure. Usage context is implied by 'arbitrary SQL' rather than explicitly stated.

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/bymcs/mssql-mcp'

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