The agent identifies errors in a provided SQL statement, corrects the syntax, and provides optimization hints or index suggestions for better performance.
The agent takes a failing SQL query and its associated error message from the user. It uses the fix_sql tool to generate a corrected statement and an explanation of the error. Optionally, it can use optimize_sql to analyze the query for performance issues, providing reasoning and index hints to improve execution speed.
- Category: Software development
- Effect: Read-only
- MCP servers: AI2SQL MCP (https://koskamo.com/explore/ai2sql-mcp)
- Source: Text-to-SQL MCP Server for Postgres, MySQL & SQL Server | AI2SQL (https://ai2sql.io/mcp)
- Source quote: "fix_sql — Paste a failing query and its error; get the corrected statement and why it broke. optimize_sql — Slow query in, faster query out, with the reasoning and index hints."
- Playbook page: https://koskamo.com/explore/use-cases/fix-and-optimize-failing-sql-queries
Prompt: Fix this failing query: [paste query and error]. Then, optimize it for better performance.