Skip to main content
Glama
mysql2-mcp-server

mysql2-mcp-server

by jcxy

mysql_query

Execute SQL queries against MySQL environments and return results; use WHERE/LIMIT to narrow output and COUNT(*) to get totals when rows are truncated.

Instructions

执行 MySQL 查询,返回查询结果。可用环境: default(默认: default)。结果行数上限: default ≤ 1000 行,超出会被截断并在返回中标记 truncated;请用 WHERE/LIMIT 收窄范围或先执行 COUNT(*) 取总数

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 查询语句
environmentNo目标环境名。可用环境: default(默认: default)。未传时使用默认环境

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does disclose concrete behavior: a 1000-row cap, truncation flagged as 'truncated' in the response, and default-environment resolution. It omits safety-relevant traits an agent needs, notably whether DDL/DML are permitted, how errors surface, and whether the query joins an open transaction.

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?

Front-loaded with purpose, then limits and mitigation advice in a compact flow with no filler sentences. The environment list is duplicated from the schema, a minor redundancy.

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 two-parameter query tool with no output schema, it explains the truncation marker adequately, but leaves the mutation scope, error behavior, and its relationship to the transaction siblings unexplained, which matters given mysql_execute and mysql_begin/commit exist.

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 both parameters are already documented in the schema, and the description largely repeats the environment default rather than adding new meaning. It adds no syntax or format guidance for the sql parameter beyond the schema.

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?

States a specific verb and resource (执行 MySQL 查询,返回查询结果) and the return contract. It does not distinguish itself from the sibling mysql_execute, leaving the agent to guess which of the two runs SQL, so it stops short of the top 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 only guidance is about query authoring (use WHERE/LIMIT or run COUNT(*) first when results are large), which is useful but not tool selection. It never says when to use this rather than mysql_execute, mysql_begin/commit, or how it interacts with a transaction.

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