Skip to main content
Glama
enemyrr

MCP-MySQL Server

execute

Run INSERT, UPDATE, or DELETE queries on MySQL databases. Provide SQL statements and optional parameters for precise database modifications using a secure connection.

Instructions

Execute an INSERT, UPDATE, or DELETE query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNoAn optional array of parameters (as strings) to bind to the SQL query placeholders (e.g., ?).
sqlYesThe SQL query string (INSERT, UPDATE, DELETE) to execute.

Implementation Reference

  • Core handler function for the 'execute' tool. Validates that the SQL is an INSERT, UPDATE, or DELETE statement and executes it using the executeQuery helper, returning the result as formatted JSON.
    private async handleExecute(args: QueryArgs): Promise<QueryResult> {
      this.validateSqlInput(args.sql, ['INSERT', 'UPDATE', 'DELETE']);
      const result = await this.executeQuery(args.sql, args.params || []);
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      };
    }
  • src/index.ts:444-466 (registration)
    Registers the 'execute' tool in the ListToolsRequestSchema handler, providing name, description, and input schema for tool discovery.
    {
      name: 'execute',
      description: 'Execute an INSERT, UPDATE, or DELETE query',
      inputSchema: {
        type: 'object',
        properties: {
          sql: {
            type: 'string',
            description: 'The SQL query string (INSERT, UPDATE, DELETE) to execute.',
          },
          params: {
            type: 'array',
            items: {
              type: 'string',
              description: 'A parameter value (as string) to bind to the query.'
            },
            description: 'An optional array of parameters (as strings) to bind to the SQL query placeholders (e.g., ?).',
            optional: true,
          },
        },
        required: ['sql'],
      },
    },
  • src/index.ts:575-576 (registration)
    Dispatches incoming CallTool requests for 'execute' to the handleExecute method.
    case 'execute':
      return await this.handleExecute(request.params.arguments as unknown as QueryArgs);
  • Helper method that performs the actual database query execution using the MySQL pool, with error handling.
    private async executeQuery<T>(sql: string, params: any[] = []): Promise<T> {
      const pool = await this.ensureConnection();
      try {
        const [result] = await pool.query(sql, params);
        return result as T;
      } catch (error) {
        this.handleDatabaseError(error);
      }
    }
  • TypeScript interface defining the input arguments for the 'execute' tool (and 'query' tool).
    interface QueryArgs {
      sql: string;
      params?: Array<string | number | boolean | null>;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool executes SQL queries but fails to mention critical traits like authentication requirements, transaction handling, error behavior, or potential side effects (e.g., data modification risks). This leaves significant gaps in understanding the tool's behavior.

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 extremely concise and front-loaded, consisting of a single, direct sentence that states the tool's purpose without any unnecessary words. Every part of the sentence earns its place by clearly conveying the core functionality.

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 complexity of executing SQL queries (a potentially destructive operation), the lack of annotations, and no output schema, the description is incomplete. It does not address safety considerations, return values, or error handling, making it inadequate for informed tool selection and invocation.

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?

The schema description coverage is 100%, so the input schema already documents both parameters ('sql' and 'params') thoroughly. The description adds no additional semantic meaning beyond what the schema provides, such as examples or constraints, resulting in a baseline score of 3.

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 action ('Execute') and the type of operations ('INSERT, UPDATE, or DELETE query'), making the purpose specific and understandable. However, it does not explicitly distinguish this tool from sibling tools like 'query' (which might handle SELECT queries), leaving room for ambiguity in differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as 'query' for SELECT operations or other siblings for schema modifications. It lacks explicit instructions on prerequisites, context, or exclusions, offering minimal usage direction.

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

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

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