Skip to main content
Glama
xiangma9712

MySQL MCP Server

test_execute

Test SQL queries for execution feasibility in MySQL databases with automatic rollback to verify query validity without data changes.

Instructions

Checks if an SQL query can be executed and rolls back afterward.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes

Implementation Reference

  • The switch case that implements the test_execute tool logic: starts a transaction, attempts to execute the SQL query, rolls back in finally, returns error if failed or success message if successful.
    case "test_execute": {
      const sql = request.params.arguments?.sql as string;
      await connection.query('START TRANSACTION');
      try {
        await connection.query(sql);
      } catch (error) {
        return {
          content: [{ type: "text", text: `Failed to execute SQL. error: ${error}` }],
          isError: true,
        };
      } finally {
        await connection.query('ROLLBACK');
      }
      return {
        content: [{ type: "text", text: "The update SQL query can be executed." }],
        isError: false,
      };
    }
  • Input schema definition for the test_execute tool, requiring a 'sql' string.
    inputSchema: {
      type: "object",
      properties: {
        sql: { type: "string" },
      },
      required: ["sql"],
    },
  • src/index.ts:50-60 (registration)
    Registration of the test_execute tool in the ListTools handler response, including name, description, and input schema.
    {
      name: "test_execute",
      description: "Checks if an SQL query can be executed and rolls back afterward.",
      inputSchema: {
        type: "object",
        properties: {
          sql: { type: "string" },
        },
        required: ["sql"],
      },
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses key behavioral traits: the tool checks executability and performs a rollback, indicating it's a safe, non-destructive operation. However, it doesn't mention error handling, performance implications, or what 'checks' entails (e.g., syntax validation, permission checks), leaving gaps for a mutation-related tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence: 'Checks if an SQL query can be executed and rolls back afterward.' It's front-loaded with the core purpose, has zero waste, and appropriately sized for the tool's complexity.

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?

Given the tool involves SQL execution testing (a mutation-related operation), no annotations, no output schema, and low parameter coverage, the description is incomplete. It lacks details on return values (e.g., success/failure indicators), error responses, or rollback specifics, making it inadequate for safe agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions 'SQL query' as the input, which adds meaning to the 'sql' parameter by specifying it's an SQL query string. However, it doesn't provide details on query format, supported SQL dialects, or constraints, failing to fully compensate for the low coverage.

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 clearly states the tool's purpose: 'Checks if an SQL query can be executed and rolls back afterward.' This specifies the verb ('checks') and resource ('SQL query'), and distinguishes it from siblings like 'query' (which likely executes queries) and 'describe_table'/'list_tables' (which are read-only metadata tools). However, it doesn't explicitly differentiate from 'query' beyond implying a test vs. execution distinction, keeping it at 4 rather than 5.

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 description implies usage context: it's for testing SQL queries before actual execution, suggesting when to use it (to validate queries) versus alternatives like 'query' (for actual execution). However, it doesn't explicitly state when-not-to-use or name alternatives, and lacks prerequisites (e.g., database connection requirements), so it's not fully explicit.

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

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