Skip to main content
Glama
pickstar-2002

MySQL MCP Server

mysql_delete

Delete specific data from MySQL tables by defining the table name and conditions using the 'mysql_delete' tool. Simplify database management with targeted data removal.

Instructions

删除表数据

Input Schema

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

Implementation Reference

  • The handler function for 'mysql_delete' tool. It constructs a parameterized DELETE SQL query using the provided tableName and where conditions object, executes it via dbManager.query, and returns a response with 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 tableName and where object as required parameters.
    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 dispatches calls to 'mysql_delete' to the handleDelete method.
    case 'mysql_delete': return await this.handleDelete(args as any);
  • src/server.ts:185-195 (registration)
    The tool registration in the ListTools response, including name, description, and schema.
    name: 'mysql_delete', description: '删除表数据', inputSchema: { type: 'object', properties: { tableName: { type: 'string', description: '表名称' }, where: { type: 'object', description: '删除条件' }, }, required: ['tableName', 'where'], }, },

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