Skip to main content
Glama
pickstar-2002

MySQL MCP Server

mysql_delete

Delete data from MySQL database tables by specifying table name and conditions. Use this tool to remove specific records while maintaining database integrity.

Instructions

删除表数据

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNameYes表名称
whereYes删除条件

Implementation Reference

  • The handler function for the 'mysql_delete' tool. It constructs a parameterized DELETE SQL statement using the provided tableName and where conditions, executes it via the DatabaseManager, and returns a response indicating the number of affected rows.
    private async handleDelete(args: { tableName: string; where: any }): Promise<any> {
      const whereClause = Object.keys(args.where).map(key => `\`${key}\` = ?`).join(' AND ');
      const sql = `DELETE FROM \`${args.tableName}\` WHERE ${whereClause}`;
      const params = Object.values(args.where);
      
      const result = await this.dbManager.query(sql, params);
      
      return {
        content: [
          {
            type: 'text',
            text: `成功删除 ${result.affectedRows} 行数据`,
          },
        ],
      };
    }
  • The input schema definition for the 'mysql_delete' tool, specifying required parameters: tableName (string) and where (object).
    {
      name: 'mysql_delete',
      description: '删除表数据',
      inputSchema: {
        type: 'object',
        properties: {
          tableName: { type: 'string', description: '表名称' },
          where: { type: 'object', description: '删除条件' },
        },
        required: ['tableName', 'where'],
      },
    },
  • src/server.ts:257-258 (registration)
    The switch case registration that maps the 'mysql_delete' tool call to the handleDelete handler function.
    case 'mysql_delete':
      return await this.handleDelete(args as any);
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 but only states the basic action. It doesn't mention critical traits like whether deletions are permanent, require specific permissions, have transaction implications, or affect related data (e.g., foreign keys). For a destructive operation, this lack of transparency is a significant gap.

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 with a single phrase ('删除表数据'), which is front-loaded and wastes no words. For a simple tool name like mysql_delete, this minimalism is appropriate, though it may sacrifice clarity.

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 a destructive database operation with no annotations and no output schema, the description is incomplete. It doesn't explain what happens on success or failure, return values, error conditions, or safety considerations. For a tool that permanently removes data, more context is needed to guide safe usage.

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 (tableName and where). The description adds no additional meaning beyond what the schema provides, such as examples of where conditions or table naming conventions. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '删除表数据' (delete table data) states the basic action but is vague about scope and lacks sibling differentiation. It doesn't specify whether this deletes all rows, filtered rows, or has other limitations compared to siblings like mysql_drop_table (which drops the entire table structure). The purpose is understandable but insufficiently specific.

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. For example, it doesn't clarify if this should be used instead of mysql_drop_table for deleting rows versus entire tables, or how it relates to mysql_update for data modification. The description offers no context about prerequisites, constraints, or typical use cases.

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

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