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

30 lines (27 loc) 712 B
import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { MysqlService } from '../services/MysqlService.js'; export const explainSchema: Tool = { name: 'mysql_explain', description: 'Returns the execution plan for a SQL query', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'SQL query to explain', }, }, required: ['query'], }, }; export async function explainHandler( mysqlService: MysqlService, args: { query: string } ): Promise<any[]> { try { const plan = await mysqlService.explain(args.query); return plan; } catch (error) { throw new Error(`Failed to explain query: ${error}`); } }