mssql_index_fragmentation
Analyze index fragmentation in SQL Server and get maintenance recommendations with ready-to-run ALTER INDEX statements. Handles REBUILD, REORGANIZE, and skips small indexes.
Instructions
Analyze index fragmentation and recommend maintenance: REBUILD (fragmentation ≥ 30%), REORGANIZE (5–30%), or OK (< 5%). Generates ready-to-run ALTER INDEX statements (ONLINE=ON suggested automatically on editions that support it). Small indexes below minPageCount are excluded since fragmentation there is harmless.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "mssql_index_fragmentation"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tableName | No | Optional: analyze only this table. | |
| minPageCount | No | Ignore indexes smaller than this many pages (default: 100 ≈ 800 KB). | |
| response_format | No | Response format (default: markdown) | markdown |