get_execution_plan
Analyze SQL query performance by retrieving the actual execution plan with runtime statistics from the Redshift MCP Server.
Instructions
Get actual execution plan with runtime statistics for a SQL query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The SQL query to analyze |
Implementation Reference
- Specific dispatch logic for the get_execution_plan tool: extracts and validates the SQL input, then prefixes it with 'EXPLAIN' to obtain the execution plan. The actual execution and result formatting follow in the shared code block.elif name == "get_execution_plan": sql = args.get("sql") if not sql: raise ValueError("sql parameter is required when calling get_query_plan tool") sql = f"EXPLAIN {sql}"
- Defines the input schema for the get_execution_plan tool, requiring a single 'sql' property of type string.inputSchema={ "type": "object", "properties": { "sql": { "type": "string", "description": "The SQL query to analyze" } }, "required": ["sql"] }
- src/redshift_mcp_server/server.py:157-170 (registration)Registers the get_execution_plan tool within the server's list_tools() response, including its name, description, and input schema.Tool( name="get_execution_plan", description="Get actual execution plan with runtime statistics for a SQL query", inputSchema={ "type": "object", "properties": { "sql": { "type": "string", "description": "The SQL query to analyze" } }, "required": ["sql"] } )