Skip to main content
Glama
SQL Query MCP Server

SQL Query MCP Server

by Tolosa527

execute_select_query

Run read-only SELECT queries against SQL Server, MySQL, or PostgreSQL databases and return result rows with column details.

Instructions

Execute a SELECT query on the database. Only SELECT queries are allowed for security. Returns the query results with rows and column information.

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_select_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe SELECT SQL query to execute

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.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 supplied, the description carries the full behavioral burden. It does disclose the read-only nature via the SELECT-only rule and sketches the return shape (rows plus column information). It omits material behavior for a query executor: row limits, timeouts, permission requirements, result truncation, and pagination — all of which affect how an agent should call it.

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?

Three short sentences, front-loaded with purpose and each contributing distinct information (capability, security constraint, return shape). No filler or redundancy; slightly more structure around result handling would still fit.

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 one-parameter tool with no output schema, the description is adequate: it explains what is returned at a high level and the SELECT-only rule. It falls short on practical call-time details — limits, timeouts, and how large result sets are handled — which matter given the absence of an output schema and annotations.

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?

There is a single parameter with 100% schema description coverage, so the schema already documents the query string. The description adds only the reminder that it must be a SELECT statement, which is marginal value over the schema baseline.

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 opens with a specific verb and resource ("Execute a SELECT query on the database"), which is clearly distinct from the sibling metadata tools (get_database_schema, list_tables). It does not explicitly name those siblings, so it stops short of full differentiation, but an agent can still place it correctly.

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?

It states a hard constraint ("Only SELECT queries are allowed for security"), which effectively tells the agent when this tool will be rejected. However, it offers no guidance on when to reach for this tool versus a metadata sibling, and no prerequisites or expected input conditions beyond that single restriction.

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