Skip to main content
Glama
GeminiDesk MCP
by LZ7TOP

Execute MySQL SQL Statement

mysql_query

Execute SQL queries and data-changing statements, returning structured JSON results with execution time; supports optional connection overrides and target database selection.

Instructions

执行 SQL 查询或变更语句,返回结构化 JSON 结果集与执行耗时。

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": {
      "sql": "<sql>"
    },
    "name": "mysql_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYes要执行的 SQL 语句
hostNo可选覆盖主机
portNo可选覆盖端口
userNo可选覆盖用户名
profileNo连接配置档案名
databaseNo目标数据库名
passwordNo可选覆盖密码

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full burden, and it only discloses the return format. It says nothing about the fact that mutations are committed (or whether transactions exist), required privileges/credentials handling, whether DDL/DROP-style statements are allowed, result-size or timeout limits — all material for a tool that will execute arbitrary SQL. The return-format sentence is the one piece of genuine behavioral value.

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?

A single front-loaded sentence with no filler; verb and return value come first. It is efficient, though for a tool of this risk profile the brevity is arguably under-specification rather than disciplined concision.

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

Completeness2/5

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

Seven parameters, no annotations, and no output schema, yet the description spends one sentence. It does supply the return shape, which partly compensates for the missing output schema, but it omits the safety and connection-resolution context an agent needs to invoke an arbitrary-SQL executor correctly.

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?

Schema description coverage is 100%, so all seven parameters (sql, host, port, user, password, profile, database) are documented in the schema, which sets the baseline at 3. The description adds no semantics of its own — notably it never explains how the 'profile' name interacts with the optional host/port/user/password overrides, a precedence question the schema leaves open.

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 names a specific verb and resource ('执行 SQL 查询或变更语句') and states the return shape ('结构化 JSON 结果集与执行耗时'), so an agent can tell it is the general-purpose SQL execution tool rather than a metadata helper like mysql_describe_table or mysql_list_databases. It stops short of explicitly contrasting itself with those siblings, so it is clear but not fully differentiated.

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

Usage Guidelines2/5

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

There is no guidance on when to choose this tool over the sibling helpers (describe/list) or over a dedicated read path, and no indication of whether queries vs mutations take different handling. The word '或' acknowledges both read and write statements but gives the agent no rule for deciding or for cautioning itself.

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