get_optimization_insights
Analyze database performance and health metrics to identify optimization opportunities and improve query efficiency.
Instructions
Get comprehensive database optimization insights and health analysis
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysis_period | No | Analysis time period: 24_HOURS, 7_DAYS, 30_DAYS (optional, defaults to 7_DAYS) | |
| database | No | Database name (optional) |
Implementation Reference
- index.js:696-715 (handler)Tool handler method that calls queryOptimizer.getOptimizationInsights and formats the JSON 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); } }
- Core helper function in QueryOptimizer that provides the optimization insights logic (currently a placeholder implementation).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({}); }
- lib/tools/tool-registry.js:214-232 (registration)Tool registration entry including name, description, and input schema.{ 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:343-346 (handler)Dispatch handler case in the main tool request handler switch statement.case 'get_optimization_insights': return { content: await this.getOptimizationInsights(args.database) };
- lib/tools/tool-registry.js:217-231 (schema)Input schema definition for get_optimization_insights tool.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'] } } }