Skip to main content
Glama

update_data

Modify existing records in MySQL database tables using SQL UPDATE queries to change data values.

Instructions

Updates data in a table in the MySQL database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe SQL UPDATE query to execute.

Implementation Reference

  • src/index.ts:136-149 (registration)
    Tool registration in the listTools response, defining name, description, and input schema for 'update_data'.
    {
      name: 'update_data',
      description: 'Updates data in a table in the MySQL database.',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'The SQL UPDATE query to execute.',
          },
        },
        required: ['query'],
      },
    },
  • src/index.ts:193-194 (registration)
    Dispatch registration in the CallToolRequest handler switch statement, routing 'update_data' to its handler.
    case 'update_data':
      return this.handleUpdateData(request, transactionId);
  • Core handler implementation for 'update_data': validates arguments and query type, executes UPDATE on MySQL pool, returns formatted success/error response.
    private async handleUpdateData(request: any, transactionId: string) {
      if (!isValidSqlQueryArgs(request.params.arguments)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid SQL query arguments.'
        );
      }
    
      const query = request.params.arguments.query;
      
      if (!isUpdateQuery(query)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Only UPDATE queries are allowed with update_data tool.'
        );
      }
    
      console.error(`[${transactionId}] Executing UPDATE query: ${query}`);
      
      try {
        const [result] = await this.pool.query(query);
        console.error(`[${transactionId}] Data updated successfully`);
        
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({
                success: true,
                message: 'Data updated successfully',
                result
              }, null, 2),
            },
          ],
        };
      } catch (error) {
        console.error(`[${transactionId}] Query error:`, error);
        if (error instanceof Error) {
          return {
            content: [
              {
                type: 'text',
                text: `MySQL error: ${error.message}`,
              },
            ],
            isError: true,
          };
        }
        throw error;
      }
    }
  • Helper function used by update_data handler to validate if the provided query starts with 'update'.
    const isUpdateQuery = (query: string): boolean => 
      query.trim().toLowerCase().startsWith('update');
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 performs updates but doesn't mention critical aspects like required permissions, whether changes are reversible, transaction handling, error behavior, or rate limits. This is inadequate for a mutation tool with zero annotation coverage.

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 with zero wasted words. It's appropriately sized and front-loaded, directly stating the tool's purpose without unnecessary elaboration.

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, no output schema, and multiple sibling tools, the description is incomplete. It lacks behavioral context, usage differentiation, and details about what happens after execution (e.g., success/failure responses, affected rows). The high schema coverage doesn't compensate for these gaps in a write operation context.

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%, with the single parameter 'query' documented as 'The SQL UPDATE query to execute'. The description adds no additional parameter details beyond what the schema provides, so it meets the baseline for high schema coverage without compensating value.

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 ('Updates') and target ('data in a table in the MySQL database'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'execute_sql' or 'run_sql_query' that might also perform updates, leaving some ambiguity about when to choose this specific tool.

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?

No guidance is provided on when to use this tool versus alternatives like 'execute_sql', 'run_sql_query', or 'delete_data'. The description lacks context about prerequisites, constraints, or explicit recommendations for tool selection among siblings.

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

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