Get Automation Traces
ha_get_automation_tracesRetrieves Home Assistant automation and script execution traces to debug triggers, condition failures, executed actions, errors, and variables; list recent runs or inspect a run by ID or context.
Instructions
Get execution traces for automations and scripts to debug issues.
Traces show what triggered a run, which conditions passed or failed, which actions executed, any errors, and variable values during execution. Home Assistant keeps only the most recent runs of each automation or script (its stored_traces setting), so older runs are not available.
Do not use this tool for general log history or recorder statistics;
use ha_get_logs for logs and ha_get_history for history/statistics.
USAGE MODES:
List recent traces (omit run_id and context_id). ha_get_automation_traces("automation.motion_light") ha_get_automation_traces(domain="automation")
Get a detailed trace (provide run_id): returns Core's extended trace dict unchanged, including config, raw step trace, context, errors and variables. Pass
sectionsto keep only named top-level keys (plus 'logbook' for the run's logbook); a requested name the run lacks is reported inwarningsand the run's own keys are listed. An emptysectionsstring means omitted. ha_get_automation_traces("automation.motion_light", run_id="1705312800.123456") ha_get_automation_traces(domain="automation", item_id="uid", run_id="...")Resolve a trace by context (provide context_id): the response selects Core's run for that context and reports
context_matchastraceorparent. With the ha_mcp_tools component,context_other_matcheslists the other runs that matched the context id (own or triggering parent); Core's owntrace/contextskeeps one run per context id. A context Core does not hold is reported as not found with a hint that the component resolves triggering (parent) contexts. ha_get_automation_traces(context_id="01J...")
RESPONSE FIELDS:
A detail response is Core's extended
trace/getdict:config,trace,context,timestamp,state,error,script_execution,blueprint_inputsand any run-specific fields.success,run_id,domainanditem_ididentify the run.entity_idis present when the caller supplied it; a context-only lookup returns Core'sdomain/item_idinstead of inventing one.context_matchistraceorparent;context_scannedreports how many stored runs the ha_mcp_tools component inspected while resolving the context id, and is 0 when Core's own-context map answered.logbook_entries,logbook_transport,logbook_totalandlogbook_truncateddescribe the run's logbook rows.
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": "ha_get_automation_traces"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of traces to return when listing (default: 10, max: 50). | |
| order | No | Order traces are returned in. 'newest' returns most-recent first; 'oldest' returns chronological-first. | newest |
| domain | No | List recent traces across every automation or script when entity_id is omitted. Required with item_id. | |
| offset | No | Number of traces to skip from the start of the requested order. Use with `limit` to page through stored traces when `total_available > limit`. | |
| run_id | No | Specific trace run_id to retrieve detailed trace. | |
| item_id | No | Core's trace item id from a list row or context resolution. Use with domain and run_id when no entity_id is available. | |
| detailed | No | Include the run's logbook entries in the detail response. | |
| sections | No | Comma-separated top-level keys from Core's extended trace dict to return, plus 'logbook' for the run's logbook. Available keys depend on the run; examples: 'trace', 'config', 'context', 'error', 'logbook'. A requested name this run lacks is reported in 'warnings'. Omit, or pass an empty string, to return Core's full extended dict. | |
| entity_id | No | Automation or script entity_id. Omit when resolving a context-only lookup. | |
| context_id | No | Context id to resolve to its trace. Accepts the trace run's own `context.id` or, with the ha_mcp_tools component, the context id of the event or service call that triggered it. Mutually exclusive with run_id. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||