Skip to main content
Glama
HiTechLabTN

hass-mcp

by HiTechLabTN

get_history_range

Retrieve the state history of an entity over a specific date/time range, returning timestamps and state changes.

Instructions

Get raw state-change history for an entity over a date/time range.

Like get_history, but takes an explicit window instead of "N hours from now". Useful for inspecting what happened on a specific day or correlating with an external event.

Args: entity_id: The entity to fetch history for. start_time: ISO-8601 start (e.g. 2026-05-15 or 2026-05-15T08:00:00Z). Treated as UTC if no offset. end_time: ISO-8601 end. Defaults to now (UTC).

Returns: Same shape as get_history: entity_id, states, count, first_changed, last_changed.

Examples: get_history_range("light.kitchen", "2026-05-15") get_history_range("sensor.power", "2026-05-15T00:00:00Z", "2026-05-16T00:00:00Z")

Best Practices: - Bound the window — wider ranges return more data and more tokens. - For aggregated long-term data, prefer get_statistics_range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_timeNo
entity_idYes
start_timeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds context about the single-timestamp invocation (start_time defaults end to now), UTC-casting of naive timestamps, the return shape, and the performance/token tradeoff of wide windows. It stops short of explicitly declaring read-only semantics, but the behavior is adequately disclosed.

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 uses clear Markdown-style section headers (Args, Returns, Examples, Best Practices) that front-load the purpose while keeping details scannable. Two runnable examples demonstrate both single-date and explicit-timestamp forms, and every sentence earns its place — no filler or redundant restatements.

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?

For a 3-parameter tool with no schema documentation, the description covers all necessary operational concerns: parameter formats, output shape, performance implications, and when to prefer an alternative. The return type is acknowledged and tied to the sibling `get_history`, reinforcing consistency. Nothing material is left unaddressed.

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?

Despite 0% schema coverage, the description fully documents all three parameters with ISO-8601 format examples (`2026-05-15` vs `2026-05-15T08:00:00Z`), timezone handling ('Treated as UTC if no offset'), and the default for end_time ('Defaults to now (UTC)'). This exactly compensates for the schema's minimal property metadata and even enriches it with semantic details like 'raw' history.

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 opening line 'Get raw state-change history for an entity over a date/time range' uses a specific verb plus resource and clearly differentiates from the sibling `get_history` by emphasizing the explicit window parameter. The phrasing 'Like get_history, but takes an explicit window' explicitly distinguishes it from its sibling, making the purpose unmistakable.

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 states when to use this tool ('inspecting what happened on a specific day or correlating with an external event') and names an alternative: 'For aggregated long-term data, prefer get_statistics_range instead.' This gives the agent clear, actionable selection criteria beyond what any structured field could convey.

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/HiTechLabTN/hass-mcp'

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