Skip to main content
Glama
Home Assistant MCP Server

Home Assistant MCP Server

by rilhia

Get script trace

get_script_trace
Read-onlyIdempotent

Inspect past Home Assistant script runs to diagnose failures: list recent runs, review the latest or a specific run, and see last step, node errors, failed conditions, and a plain-English diagnosis.

Instructions

Inspect past runs of a script to diagnose failures. Without run_id it lists recent runs and details the most recent one. Reports the last step reached, node level errors, failed conditions and a plain English diagnosis.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "script_id": "<script_id>"
    },
    "name": "get_script_trace"
  }
}

Input Schema

NameRequiredDescriptionDefault
run_idNoA specific run id from the run list. Defaults to the most recent run.
script_idYesThe script config id or entity id.
runs_limitNoHow many recent runs to list.
only_failedNoPick the most recent run that did not finish cleanly.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive, so safety is covered; the description instead adds output substance — last step reached, node-level errors, failed conditions, and a plain-English diagnosis. That is genuinely useful behavioral context given there is no output schema. It does not mention cost, rate limits, or what happens when a script has no runs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, front-loaded with the purpose, then the run_id conditional, then the return contents. No filler or redundant restatement of the tool name.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a read-only diagnostic tool with no output schema, the description does the essential work of enumerating return contents and explaining the run_id branch. Only the edge cases (script with no runs, unknown run_id) are unaddressed, which is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and the schema already documents run_id defaulting to the most recent run and runs_limit bounds. The description adds only the interaction between omitting run_id and the run-list behavior; it says nothing about only_failed or script_id formats beyond the schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Inspect past runs of a script') plus its purpose ('diagnose failures'), which clearly separates it from list_scripts/get_script. It does not explicitly name the closest sibling, get_automation_trace, so the script-vs-automation distinction must be inferred from the resource name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete conditional guidance: with run_id you inspect a specific run, without it the tool lists recent runs and details the most recent. That covers the main branching decision for an agent. It stops short of exclusions, e.g. pointing to get_automation_trace for automation traces or get_script for config, so it is clear context without full routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.