Skip to main content
Glama
tokenlite-mysql-mcp

tokenlite-mysql-mcp

by andezdev

mydatabase_execute_safe_query

Read-only

Execute validated SQL queries against the configured schema, with row caps and blocked full-table scans to prevent unsafe or runaway database access.

Instructions

Executes SQL against the database with AST validation. SELECT results are capped by MCP_QUERY_ROW_LIMIT (default 500, AST-injected LIMIT) and include a '-- rows: N (truncated at LIMIT X)' footer when the cap is reached. Unindexed full table scans above MCP_EXPLAIN_MAX_SCAN_ROWS are blocked before execution. Only the configured schema is reachable: SHOW statements, information_schema/mysql/performance_schema/sys, other schemas, server variables, SELECT ... INTO and functions such as LOAD_FILE or SLEEP are rejected by the server. To explore the schema use 'search_schema'.

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": "mydatabase_execute_safe_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL SELECT statement to execute.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv3.1.2

TDQS

A4.3/5.0
Behavior5/5

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

Goes well beyond the readOnlyHint/destructiveHint annotations: it discloses the row cap and its env-var default, the AST-injected LIMIT, the truncation footer emitted on capped results, pre-execution blocking of unindexed full scans, and the schema/function restrictions enforced server-side. These are exactly the behavioral facts an agent needs before composing a query.

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-loads the core action, then layers limits, blocking rules, and the alternative tool in a tight sequence with no filler. It is dense—env var names, rejection list, and footer format packed into three sentences—so structure is serviceable but slightly wall-of-text.

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

Completeness5/5

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

For a single-parameter read-only tool with no output schema, the description covers result shape (the truncation footer), limits, permission/schema scope, rejected operations, and the correct alternative for schema discovery. Nothing an agent needs in order to call it correctly is missing.

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 single parameter has 100% schema coverage, so the baseline would be 3; the description adds real meaning by narrowing valid content to SELECT-only, excluding SHOW, SELECT ... INTO, and functions like LOAD_FILE/SLEEP that the schema's 'SQL SELECT statement' wording alone would not rule out.

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 ('Executes SQL against the database') plus the mechanism ('AST validation'), which is far more than a restatement of the name. It distinguishes itself from search_schema by routing schema exploration there, but never mentions the close sibling explain_query, so the boundary against a plan-inspection tool is left implicit.

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?

Gives clear usage context and an explicit exclusion: 'To explore the schema use search_schema', plus a list of statement classes that will be rejected, which steers the agent away from invalid calls. It stops short of saying when to prefer explain_query over execution for cost/plan checking.

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