Skip to main content
Glama

get_index_recommendations

Analyze SQL Server databases to identify missing indexes that improve query performance and optimize database operations based on impact scoring.

Instructions

Get index recommendations for database optimization

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNoDatabase name (optional)
impact_thresholdNoMinimum impact score threshold (0-100, optional)
limitNoMaximum number of recommendations to return (optional, defaults to 10)
schemaNoSchema name (optional, defaults to dbo)

Implementation Reference

  • Main handler function that executes the tool logic by calling QueryOptimizer.analyzeIndexUsage and formatting the JSON response.
    async getIndexRecommendations(database) { try { const recommendations = await this.queryOptimizer.analyzeIndexUsage(database); return [ { type: 'text', text: JSON.stringify( { success: true, data: recommendations }, null, 2 ) } ]; } catch (error) { throw new McpError(ErrorCode.InternalError, error.message); } }
  • index.js:328-331 (registration)
    Switch case that registers and dispatches the tool call to the handler method.
    case 'get_index_recommendations': return { content: await this.getIndexRecommendations(args.database) };
  • Tool definition including name, description, and input schema validation.
    { name: 'get_index_recommendations', description: 'Get index recommendations for database optimization', inputSchema: { type: 'object', properties: { database: { type: 'string', description: 'Database name (optional)' }, schema: { type: 'string', description: 'Schema name (optional, defaults to dbo)' }, limit: { type: 'number', description: 'Maximum number of recommendations to return (optional, defaults to 10)' }, impact_threshold: { type: 'number', description: 'Minimum impact score threshold (0-100, optional)' } } } },
  • Supporting function that provides the actual index recommendations (delegated by the handler).
    async analyzeIndexUsage(database) { // Basic index recommendations - this would normally query SQL Server DMVs return { database, timestamp: new Date().toISOString(), recommendations: [ { type: 'missing_index', priority: 'high', suggestion: 'Consider adding indexes on frequently queried columns', impact: 'Could improve query performance by 50-80%', table: 'example_table', columns: ['column1', 'column2'] } ], unusedIndexes: [], duplicateIndexes: [], fragmentedIndexes: [] }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/egarcia74/warp-sql-server-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server