Skip to main content
Glama
aderik

ha-automation-mcp

by aderik

get_history

Retrieve state-change history for Home Assistant entities from the recorder to diagnose flapping sensors or see when an automation last ran.

Instructions

Fetch state-change history for one or more entities from HA's recorder.

Default window: last 24 hours. Use this to diagnose flapping sensors (count of changes) or to inspect when an automation last ran.

Args: entity_id: A single entity id, or comma-separated list for multiple (e.g. 'sensor.x,sensor.y'). hours: Window length in hours, ending at end (default now). days: Window length in days. Ignored if hours is set. start: ISO-format start datetime (e.g. '2026-05-22T00:00:00+00:00'). Overrides hours/days. end: ISO-format end datetime (default: now). significant: If true, use get_significant_states (HA's filtered view). Default false = every recorded state change. minimal: Smaller response shape (state + last_changed only). Default true. no_attributes: Strip attributes from the response. Default true.

Returns: {start, end, counts: {entity_id: n}, items: {entity_id: [...]}}. counts is the quickest way to see how often a sensor flipped.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endNo
daysNo
hoursNo
startNo
minimalNo
entity_idYes
significantNo
no_attributesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden: it discloses the default window, parameter precedence rules, the effect of significant/minimal/no_attributes, and the exact return shape. Missing only non-critical details like rate limits or auth requirements.

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?

Front-loaded with purpose, default window, and use cases before structured Args and Returns sections. The length is appropriate for an 8-parameter tool with zero schema descriptions, and every sentence carries information.

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

Completeness5/5

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

Given no annotations, no output schema, and 0% schema description coverage, the description fills all critical gaps. It covers parameter semantics, precedence, behavioral flags, and the return shape, leaving an agent fully equipped to call it correctly.

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

Parameters5/5

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

Schema description coverage is 0% for 8 parameters, so the description must compensate, and it does so thoroughly. Each parameter is documented with type, default, format, and interaction rules (e.g., 'days' ignored if 'hours' is set, 'start' overrides both), adding substantial meaning beyond the bare schema.

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

Purpose5/5

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

States a specific verb ('Fetch') and resource ('state-change history') scoped to one or more entities from HA's recorder, which distinguishes it from current-state tools like get_state. An agent can immediately tell what it returns and where the data comes from.

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?

Provides two concrete diagnostic use cases (flapping sensors, automation last run) and notes the default 24-hour window. It does not name alternatives (e.g., get_state for current values) or state when not to use this tool, but the context is clear.

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