{ "name": "optimize_database_query", "description": "Analyze and optimize database queries for performance with detailed recommendations", "parameters": { "type": "object", "properties": { "sql_query": { "type": "string", "description": "SQL query to optimize" }, "database_type": { "type": "string", "enum": ["mysql", "postgresql", "oracle", "sqlserver", "sqlite"], "description": "Database management system type" }, "table_schemas": { "type": "array", "items": { "type": "object", "properties": { "table_name": {"type": "string"}, "columns": {"type": "array", "items": {"type": "string"}}, "indexes": {"type": "array", "items": {"type": "string"}}, "row_count": {"type": "integer"} } }, "description": "Schema information for relevant tables" }, "performance_target": { "type": "string", "enum": ["speed", "memory", "balanced"], "description": "Primary optimization goal", "default": "balanced" }, "include_execution_plan": { "type": "boolean", "description": "Generate detailed execution plan analysis", "default": true }, "suggest_indexes": { "type": "boolean", "description": "Recommend new indexes if beneficial", "default": true } }, "required": ["sql_query", "database_type"] }, "test_questions": [ "Optimize this MySQL query for speed: 'SELECT * FROM users WHERE created_at > 2023-01-01 ORDER BY name'", "Analyze this PostgreSQL query and suggest indexes: 'SELECT u.name, p.title FROM users u JOIN posts p ON u.id = p.user_id WHERE p.status = active'", "Help optimize this Oracle query for memory efficiency with execution plan details" ] }