Skip to main content
Glama
Atomzzm
by Atomzzm

execute

Execute INSERT, UPDATE, or DELETE queries to modify data in MySQL databases through the MCP MySQL Server.

Instructions

Execute an INSERT, UPDATE, or DELETE query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL query (INSERT, UPDATE, DELETE)
paramsNoQuery parameters (optional)

Implementation Reference

  • Implements the core logic for the 'execute' tool: validates input, ensures DB connection, executes non-SELECT SQL queries (INSERT/UPDATE/DELETE), and returns JSON-stringified results.
    private async handleExecute(args: any) {
      await this.ensureConnection();
    
      if (!args.sql) {
        throw new McpError(ErrorCode.InvalidParams, 'SQL query is required');
      }
    
      const sql = args.sql.trim().toUpperCase();
      if (sql.startsWith('SELECT')) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Use query tool for SELECT statements'
        );
      }
    
      try {
        const [result] = await this.connection!.query(args.sql, args.params || []);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        throw new McpError(
          ErrorCode.InternalError,
          `Query execution failed: ${getErrorMessage(error)}`
        );
      }
    }
  • Schema definition for the 'execute' tool, including name, description, and input schema specifying required 'sql' string and optional 'params' array.
    {
      name: 'execute',
      description: 'Execute an INSERT, UPDATE, or DELETE query',
      inputSchema: {
        type: 'object',
        properties: {
          sql: {
            type: 'string',
            description: 'SQL query (INSERT, UPDATE, DELETE)',
          },
          params: {
            type: 'array',
            items: {
              type: ['string', 'number', 'boolean', 'null'],
            },
            description: 'Query parameters (optional)',
          },
        },
        required: ['sql'],
      },
    },
  • src/index.ts:199-200 (registration)
    Registers the 'execute' tool handler in the CallToolRequestSchema switch statement, routing calls to handleExecute.
    case 'execute':
      return await this.handleExecute(request.params.arguments);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Execute an INSERT, UPDATE, or DELETE query' implies a write/mutation operation, it doesn't disclose critical behaviors like transaction handling, error conditions, permission requirements, or whether changes are reversible. The description is minimal and lacks necessary context for safe use.

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 - a single sentence with zero wasted words. It's front-loaded with the core functionality and appropriately sized for what it communicates. Every word earns its place in this minimal description.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't address what happens after execution (success/failure indicators, affected rows), doesn't mention connection requirements despite 'connect_db' being a sibling, and provides no safety guidance for destructive operations. The minimal description leaves too many contextual gaps.

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 description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds no additional meaning beyond what's in the schema - it mentions INSERT/UPDATE/DELETE queries which aligns with the schema's 'sql' parameter description but provides no extra syntax, format, or usage details. Baseline 3 is appropriate when schema does the heavy lifting.

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 executes SQL queries (INSERT, UPDATE, DELETE), providing a specific verb ('Execute') and resource ('query'). However, it doesn't distinguish this from the sibling 'query' tool, which likely handles SELECT queries, leaving some ambiguity about when to use each.

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. It doesn't mention the sibling 'query' tool for SELECT operations or clarify prerequisites like needing an established database connection (implied by 'connect_db' sibling). No exclusions or context for usage is provided.

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

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