UNPKG

@rolandohuber/mysql-mcp-server

Version:

A comprehensive MCP server for MySQL database operations with 16 tools, multi-transport support, and intelligent test data generation

34 lines (31 loc) 932 B
import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { MysqlService } from '../services/MysqlService.js'; export const deleteSchema: Tool = { name: 'mysql_delete', description: 'Deletes records from a table based on a WHERE clause', inputSchema: { type: 'object', properties: { table: { type: 'string', description: 'Name of the table to delete from', }, where: { type: 'string', description: 'WHERE clause condition (without the WHERE keyword)', }, }, required: ['table', 'where'], }, }; export async function deleteHandler( mysqlService: MysqlService, args: { table: string; where: string } ): Promise<{ affectedRows: number }> { try { const result = await mysqlService.delete(args.table, args.where); return result; } catch (error) { throw new Error(`Failed to delete records from ${args.table}: ${error}`); } }