mssql_get_deadlocks
Retrieve recent deadlock events from SQL Server's system_health session, including deadlock graph XML, victim sessions, and involved queries to diagnose blocking issues.
Instructions
Retrieve recent deadlock events from the built-in system_health Extended Events session, including the full deadlock graph XML, victim sessions, and the queries involved. Source 'ring_buffer' (default, fast, recent events only) or 'file' (reads system_health .xel files, further back but slower). Supported: SQL Server 2019 (15.x), 2022 (16.x), 2025 (17.x) — all editions including Express. Requires VIEW SERVER STATE.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | 'ring_buffer' = in-memory recent events (fast). 'file' = system_health event files (older history, slower). | ring_buffer |
| maxEvents | No | Maximum number of deadlock events to return (default: 5, max: 25) | |
| response_format | No | Response format (default: markdown) | markdown |