mssql_manage_indexes
Get, create, drop, rebuild, and analyze SQL Server indexes to optimize database performance.
Instructions
Manage SQL Server indexes - get, create, drop, rebuild/reorganize, and analyze usage with a single tool. Examples: operation="get" to list indexes, operation="create" with indexName, tableName, columns, operation="analyze_usage" for performance analysis
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Reindex mode | rebuild |
| type | No | Type of target for reindex (required for reindex operation) | |
| where | No | Filter predicate for a filtered index (for create operation) | |
| method | No | Index type (for create operation) | nonclustered |
| schema | No | Schema name (defaults to dbo) | |
| target | No | Target name for reindex (required for reindex operation) | |
| unique | No | Create unique index (for create operation) | |
| cascade | No | Accepted for compatibility; SQL Server DROP INDEX has no CASCADE | |
| columns | No | Key column names (required for create, except clustered columnstore) | |
| include | No | INCLUDE columns (for create operation) | |
| ifExists | No | Include IF EXISTS clause (for drop operation) | |
| indexName | No | Index name (required for create/drop) | |
| operation | Yes | Operation: get (list indexes), create (new index), drop (remove index), reindex (rebuild/reorganize), analyze_usage (find unused/duplicate) | |
| tableName | No | Table name (optional for get/analyze_usage/drop, required for create) | |
| concurrent | No | Build ONLINE (for create operation; Enterprise/Azure only) | |
| showUnused | No | Include unused indexes (for analyze_usage operation) | |
| ifNotExists | No | Skip creation when the index exists (for create operation) | |
| includeStats | No | Include usage statistics (for get operation) | |
| minSizeBytes | No | Minimum index size in bytes (for analyze_usage operation) | |
| showDuplicates | No | Detect duplicate indexes (for analyze_usage operation) | |
| connectionString | No | SQL Server connection string (optional; requires --allow-tool-connection-string) |