get_optimization_insights
Analyze SQL Server database performance and health to identify optimization opportunities. Provides insights on query efficiency, resource usage, and configuration improvements.
Instructions
Get comprehensive database optimization insights and health analysis
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | No | Database name (optional) | |
| analysis_period | No | Analysis time period: 24_HOURS, 7_DAYS, 30_DAYS (optional, defaults to 7_DAYS) |
Implementation Reference
- lib/tools/tool-registry.js:214-232 (schema)Defines the input schema and metadata for the get_optimization_insights tool.{ name: 'get_optimization_insights', description: 'Get comprehensive database optimization insights and health analysis', inputSchema: { type: 'object', properties: { database: { type: 'string', description: 'Database name (optional)' }, analysis_period: { type: 'string', description: 'Analysis time period: 24_HOURS, 7_DAYS, 30_DAYS (optional, defaults to 7_DAYS)', enum: ['24_HOURS', '7_DAYS', '30_DAYS'] } } } },
- index.js:240-242 (registration)Registers the tool in the MCP server's tool list via getAllTools() from tool-registry.// Register tools from the tool registry this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getAllTools()
- index.js:343-346 (handler)Dispatch handler in the main tool switch statement that invokes the specific optimization insights method.case 'get_optimization_insights': return { content: await this.getOptimizationInsights(args.database) };
- index.js:696-715 (handler)Primary handler method that delegates to QueryOptimizer and formats the response for MCP.async getOptimizationInsights(database) { try { const insights = await this.queryOptimizer.getOptimizationInsights(database); return [ { type: 'text', text: JSON.stringify( { success: true, data: insights }, null, 2 ) } ]; } catch (error) { throw new McpError(ErrorCode.InternalError, error.message); } }
- lib/analysis/query-optimizer.js:783-795 (handler)Core QueryOptimizer implementation for getOptimizationInsights (currently a placeholder).async getOptimizationInsights(query) { const pool = this.connectionManager.getPool(); if (!pool) { throw new Error('Not connected to any server'); } if (!query) { throw new Error('Query is required for getOptimizationInsights'); } // Placeholder for actual implementation return Promise.resolve({}); }