Skip to main content
Glama

get_history

Retrieve raw state change timestamps for any Home Assistant entity. Specify hours or a date range, set a record limit, and choose sampling strategy (recent, first, or even) to manage results. Ideal for doors, switches, and short periods.

Instructions

Get raw state changes for an entity. For aggregated trends, use get_statistics instead.

By default returns last N hours. Provide start_time to query a specific date range instead. Best for: exact state change timestamps, infrequently-changing entities (doors, switches), short time periods. NOT for: long ranges on frequently-updating sensors — use get_statistics.

Args: entity_id: Entity ID to get history for hours: Hours of history (default: 24). Ignored if start_time is provided. start_time: ISO 8601, date only, or 'yesterday'/'today'. If set, uses range mode instead of hours. end_time: End of range (default: 'now'). Only used with start_time. limit: Max records (1-500, default: 100) sample_strategy: 'recent' (default), 'first', or 'even' — how to sample if over limit minimal_response: Reduce response size in range mode (default: true)

Examples: get_history("binary_sensor.front_door") get_history("sensor.temperature", hours=1, limit=50) get_history("sensor.temp", start_time="2025-10-28T10:00:00Z", end_time="2025-10-28T11:00:00Z") get_history("light.living_room", start_time="yesterday", end_time="today")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_idYes
hoursNo
start_timeNo
end_timeNo
limitNo
sample_strategyNorecent
minimal_responseNo
Behavior4/5

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

The description explains default behavior (last N hours), range mode with start_time, sampling strategies, and minimal response. It does not mention permissions or rate limits, but as a read-only operation, this is sufficient. No annotations were provided, so the description carries the full burden and does so adequately.

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?

The description is well-structured with a clear purpose, usage guidelines, Args list, and examples. Every sentence adds value, and there is no redundancy or fluff.

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

Completeness3/5

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

The description explains what the tool does and its parameters well, but it lacks details about the return value structure. Without an output schema, the agent is left to infer the format of 'raw state changes.' Additionally, error cases and permissions are not mentioned. While the description is strong for a complex tool, this gap in output documentation reduces completeness.

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 coverage is 0%, but the description adds comprehensive parameter details: entity_id meaning, hours default and ignore condition, start_time accepted values, end_time default, limit constraints, sample_strategy options, and minimal_response purpose. Examples further clarify usage.

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?

The description starts with 'Get raw state changes for an entity,' which is a specific verb and resource. It also distinguishes itself from the sibling tool 'get_statistics' by mentioning that tool is for aggregated trends.

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

Usage Guidelines5/5

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

The description explicitly says when to use this tool (exact timestamps, infrequently-changing entities, short periods) and when not to (long ranges on frequently-updating sensors), directing users to 'get_statistics' as an alternative.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rmaher001/hass-mcp-plus'

If you have feedback or need assistance with the MCP directory API, please join our Discord server