Skip to main content
Glama
zhusinian
by zhusinian

execute_sql

Execute a single SQL statement for PostgreSQL or MySQL databases with positional parameters. Use placeholders $1, $2 for PostgreSQL and ? for MySQL.

Instructions

Execute one PostgreSQL or MySQL SQL statement with optional positional parameters. Generate normal SQL, not MongoDB syntax. Use params instead of interpolating values into sql. For PostgreSQL placeholders use $1, $2, ...; for MySQL placeholders use ?. In --readOnly mode, write/transaction/unknown SQL is rejected.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSingle SQL statement for PostgreSQL or MySQL. PostgreSQL uses $1, $2 placeholders; MySQL uses ? placeholders.
paramsNoValues for positional placeholders. Use this instead of string-concatenating user values into SQL.
connectionIdNoConnection id. Defaults to the latest connection.
Behavior3/5

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

No annotations provided, so description carries full burden. It discloses readOnly mode restriction and database support, but does not describe return format (e.g., result set or affected rows) or error behavior. This gap lowers transparency.

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?

Four sentences, each with distinct information: statement execution, SQL dialect, param usage, and readOnly behavior. No redundancy or fluff.

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 no output schema, the description covers execution behavior, database support, param guidance, and readOnly mode. Missing return value specification, but overall adequate for a SQL tool with moderate complexity.

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%, baseline 3. The description adds value by detailing placeholder syntax for PostgreSQL and MySQL and emphasizing use of params over interpolation, which aids correct parameter usage.

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 it executes one SQL statement for PostgreSQL or MySQL, and explicitly contrasts with MongoDB syntax. The verb 'execute' and resource 'SQL' are specific, and it distinguishes from sibling execute_mongodb.

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?

Provides guidance on using params instead of interpolation, explains placeholder syntax per database, and notes that write/transaction SQL is rejected in --readOnly mode. Doesn't explicitly compare to transaction or connection tools but gives sufficient context for correct usage.

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/zhusinian/db-mcp'

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