Skip to main content
Glama
neverinfamous

MySQL MCP Server

MySQL Execute Code

mysql_execute_code
Destructive

Execute sandboxed TypeScript/JavaScript code with access to MySQL APIs for CRUD, transactions, JSON, performance, and more.

Instructions

Execute TypeScript/JavaScript code in a sandboxed environment with access to all MySQL tools via the mysql.* API.

Available API groups:

  • mysql.core: readQuery, writeQuery, listTables, describeTable, createTable, createIndex (8 methods)

  • mysql.transactions: begin, commit, rollback, savepoint, execute (7 methods)

  • mysql.json: extract, set, insert, remove, contains, keys, merge, diff, stats (17 methods)

  • mysql.text: regexpMatch, likeSearch, soundex, substring, concat, collationConvert (6 methods)

  • mysql.fulltext: fulltextSearch, fulltextCreate, fulltextBoolean, fulltextExpand (5 methods)

  • mysql.performance: explain, explainAnalyze, slowQueries, bufferPoolStats, tableStats (8 methods)

  • mysql.optimization: indexRecommendation, queryRewrite, forceIndex, optimizerTrace (4 methods)

  • mysql.admin: optimizeTable, analyzeTable, checkTable, repairTable, flushTables, killQuery, serverConfig, appendInsight, auditSearch (9 methods)

  • mysql.monitoring: showProcesslist, showStatus, showVariables, innodbStatus, poolStats (7 methods)

  • mysql.backup: createDump, exportTable, importData, restoreDump (4 methods)

  • mysql.replication: masterStatus, slaveStatus, binlogEvents, gtidStatus, replicationLag (5 methods)

  • mysql.partitioning: partitionInfo, addPartition, dropPartition, reorganizePartition (4 methods)

  • mysql.schema: listSchemas, createView, listFunctions, listTriggers (10 methods)

  • mysql.events: eventCreate, eventAlter, eventDrop, eventList, schedulerStatus (6 methods)

  • mysql.sysschema: sysSchemaStats, sysStatementSummary, sysIoSummary (8 methods)

  • mysql.stats: descriptive, percentiles, correlation, regression, timeSeries, histogram (8 methods)

  • mysql.spatial: distance, distanceSphere, point, polygon, buffer (12 methods)

  • mysql.security: sslStatus, userPrivileges, audit, sensitiveTables (9 methods)

  • mysql.cluster: clusterStatus, grStatus, grMembers, clusterTopology (10 methods)

  • mysql.roles: roleCreate, roleGrant, roleAssign, roleList (8 methods)

  • mysql.docstore: docCreateCollection, docFind, docAdd, docModify (9 methods)

  • mysql.router: routerStatus, routerRoutes, routerRouteHealth (9 methods)

Example:

const tables = await mysql.core.listTables();
const results = [];
for (const t of tables.tables) {
    const count = await mysql.core.readQuery(`SELECT COUNT(*) as n FROM \`${t.name}\``);
    results.push({ table: t.name, rows: count.rows[0].n });
}
return results;

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsNoAlias for code
sqlNoAlias for code
codeNoTypeScript/JavaScript code to execute. Use mysql.{group}.{method}() for database operations. Note: Pass code, not script, javascript, or query.
evalNoAlias for code
queryNoAlias for code
scriptNoAlias for code
commandNoAlias for code
executeNoAlias for code
timeoutNoExecution timeout in milliseconds (max 30000, default 30000)
readonlyNoIf true, restricts to read-only operations
javascriptNoAlias for code

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeNoError code (e.g. VALIDATION_ERROR, QUERY_ERROR)
hintNoHelpful tip or additional information
logsNoCaptured console output from execution
errorNoError message if execution failed
resultNoReturn value from the executed code
detailsNoAdditional error context
metricsNoExecution performance metrics
successYesWhether the code executed successfully
categoryNoError category (validation, query, connection, internal)
suggestionNoSuggested fix for the error
recoverableNoWhether the error is recoverable
Behavior3/5

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

Annotations already declare readOnlyHint=false and destructiveHint=true. The description adds that execution is in a 'sandboxed environment' and allows readonly restriction via parameter, but does not disclose other behavioral traits like auth requirements or side effects beyond the annotation hints.

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?

The description is long due to the exhaustive list of API groups and an example. It is front-loaded with the core purpose, but the list could be summarized to improve conciseness without losing essential information.

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 the complexity (11 parameters, many aliases, output schema exists), the description provides adequate context on code execution and available APIs. It covers the main usage but could add more guidance on parameter interactions.

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 coverage is 100%, and the description mentions the 'code' parameter and briefly readonly/timeout, but does not add significant meaning beyond the schema descriptions. The listing of aliases is clear but not enhancing meaning.

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 TypeScript/JavaScript code in a sandboxed environment with access to MySQL tools via mysql.* API. It distinguishes from sibling tools which are individual operations, making the purpose unmistakable.

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?

The description lists all available API groups, implying when to use this tool for complex logic vs calling individual tools. It does not explicitly state when not to use it, but the context of sibling tools provides that guidance.

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/neverinfamous/mysql-mcp'

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