Analyze database schema and run read-only queries
The agent retrieves the schema of specified tables and executes a read-only SQL query, returning up to 1,000 rows of data without modifying the database.
How it works
Read-onlyData and analysis
The agent first uses the server to list available database connections and describe the schema of the relevant tables to ensure accurate SQL generation. It then constructs a SELECT or WITH statement based on the user's natural language request. Finally, it executes the query via the run_query tool, ensuring the result is returned within the 10-second timeout and 1,000-row limit.
Prompt
Paste this into an agent that has the servers below connected. Adjust the names and dates to your own.
Prompt for Analyze database schema and run read-only queries
List my database connections. Then, describe the schema of the 'orders' table. Finally, run a query to show me last month's orders.MCP servers it needs
Source
The vendor page this playbook is drawn from, and the passage that supports it.
Only a single SELECT or WITH statement runs; writes, DDL and multi-statement batches are rejected server-side.Text-to-SQL MCP Server for Postgres, MySQL & SQL Server | AI2SQL