Skip to content

Available Tools

MCP Go MySQL exposes 10 tools. Read tools cover everything you need to inspect a schema and pull data; the single execute tool covers writes; explain and database_info cover analysis and metadata.

query — Execute SELECT/WITH/SHOW Queries

Section titled “query — Execute SELECT/WITH/SHOW Queries”

Purpose: Run any read-only statement.

Accepted verbs: SELECT, WITH (CTEs), SHOW, DESCRIBE, EXPLAIN, USE.

Usage: “Show me the 10 most recent users.”

SELECT * FROM users ORDER BY created_at DESC LIMIT 10

Filtered counts also go here:

SELECT COUNT(*) FROM users WHERE active = 1

The count tool handles only unfiltered counts; anything with a WHERE belongs in query so it goes through the verb classifier and stacked-statement detector.

Purpose: Get every table in the current schema with metadata.

Returns: name, type, storage engine, approximate row count, comment.

Usage: “What tables are in the database?“

Purpose: Show the columns of a table or view.

Returns: column name, type, nullability, key, default, extra, comment.

Usage: “Describe the users table.”

If ALLOWED_TABLES is set, this tool will refuse tables outside the whitelist.

Purpose: List all views in the current schema with their definitions.

Usage: “List available views.”

Purpose: Show all indexes for a given table.

Returns: index name, column, sequence, uniqueness, cardinality.

Usage: “What indexes does the orders table have?”

Internally uses a prepared statement, so the table name cannot smuggle SQL.

Purpose: Unfiltered row count of a single table.

Usage: “How many rows does the users table have?”

SELECT COUNT(*) FROM users

For filtered counts, use query with SELECT COUNT(*) FROM table WHERE .... This is intentional: it routes the user-supplied WHERE through the same validation as any other SELECT.

Purpose: First N rows of a table (default 10, max 100).

Usage: “Give me 5 example products.”

execute — Run INSERT/UPDATE/DELETE/REPLACE

Section titled “execute — Run INSERT/UPDATE/DELETE/REPLACE”

Purpose: Single tool for all data modifications.

Usage: “Update order 123 status to ‘shipped’.”

UPDATE orders SET status = 'shipped' WHERE order_id = 123

Row-count gate:

  • Operations affecting MAX_SAFE_ROWS rows (default 100): execute directly.
  • Operations affecting more rows: rolled back unless you pass confirm_key matching SAFETY_KEY.

This catches the “ups, I forgot the WHERE” case. The classifier itself does not reject UPDATE/DELETE without WHERE — that decision is made on the actual row count, not on the syntax.

Purpose: Show how MySQL/MariaDB will execute a SELECT.

Usage: “Why is this query slow?”

EXPLAIN SELECT * FROM orders WHERE user_id = 123

Returns: join type, possible keys, key used, rows examined, extra info.

explain only accepts SELECT statements.

Purpose: Connection and server information.

Usage: “What MySQL version am I connected to?”

Returns: server version, version comment, current database, current user, hostname, port.

User saysClaude uses
”How many orders do we have today?”query with SELECT COUNT(*) ... WHERE date = CURDATE()
”Show me the structure of the products table”describe
”Update user 42 email to new@email.comexecute (single row, no confirmation)
“Set all clearance products to 10% off”execute — if it touches >100 rows, asks for confirm_key
”This query is slow, why?”explain
”What database am I connected to?”database_info

The verb classifier runs on every statement before it reaches the driver. See the Security page for the full categorisation. Quick summary:

CategoryExamplesWhy
Forbidden verbsGRANT, REVOKE, SET, FLUSH, RESET, KILL, SHUTDOWN, LOAD, HANDLER, INSTALL, LOCKPrivilege management, filesystem access, server control. Always rejected.
Filesystem clauses... INTO OUTFILE '/tmp/x', ... INTO DUMPFILE '/tmp/x'Filesystem write. Always rejected.
Stacked statementsSELECT 1; DROP DATABASE fooMultiple statements in one call. Rejected.
DDLCREATE, DROP, ALTER, TRUNCATE, RENAMERejected unless ALLOW_DDL=true.
Unknown verbFOOBAR usersWhitelist-only. Rejected.

What is not in this list (intentionally): SELECT SLEEP(1), SELECT BENCHMARK(...), SELECT EXTRACTVALUE(...). These are legitimate SQL functions and the classifier no longer special-cases them.