Skip to main content
Glama
HiTechLabTN

hass-mcp

by HiTechLabTN

get_statistics_range

Retrieve historical aggregated statistics for any Home Assistant entity over a custom date range, even months or years old, using flexible time periods.

Instructions

Get long-term aggregated statistics for an entity over a date/time range.

Same data source as get_statistics, but with an explicit window — useful for "what was my power usage from Jan 1 to Jan 31?" type questions. Aggregated bucket data survives the short-term retention window, so this works for data months/years old.

Args: entity_id: The entity (must be statistics-tracked). start_time: ISO-8601 start (2026-01-01 or 2026-01-01T00:00:00Z). UTC if no offset. end_time: ISO-8601 end. Defaults to now. period: 5minute, hour, day, week, or month.

Returns: entity_id, period, start_time, end_time, statistics.

Examples: get_statistics_range("sensor.energy", "2026-01-01", "2026-02-01", period="day") get_statistics_range("sensor.temperature", "2026-05-01", period="hour")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNohour
end_timeNo
entity_idYes
start_timeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It explains that aggregated bucket data survives the short-term retention window, which is useful. However, it does not disclose potential errors (e.g., if entity is not statistics-tracked beyond a general note), rate limits, or whether this is a read-only operation. Since the context implies a read-only query, but no explicit statement is made, the transparency is adequate but not comprehensive.

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

Conciseness4/5

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

The description is well-structured with sections for purpose, args, returns, and examples. It is detailed but not bloated. It includes exactly the necessary information without repetition. The only minor issue is the extra line about retention, which is useful but could be seen as slightly beyond essential, but it still earns its place. Overall it is efficient and well-organized.

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?

The tool has a moderate complexity with 4 parameters, an output schema exists, and no annotations. The description covers the essential context: what it does, parameter semantics, examples, and a comparison to a sibling. The only missing piece is explicit error conditions or limitations (e.g., what if end_time is before start_time), but the provided info is sufficient for most use cases. Given the presence of an output schema, the description doesn't need to explain return values in detail. It is complete for a typical agent's needs.

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 description coverage is 0%, so the description must compensate. It provides definitions for all four parameters: entity_id ('must be statistics-tracked'), start_time (ISO-8601 format with UTC default), end_time (defaults to now), and period (lists valid values). The examples also illustrate usage. This adds value beyond the schema, which only has titles. However, it doesn't add details like end_time inclusion/exclusion semantics or period effect on output granularity, so a 3 is appropriate.

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 explicitly states 'Get long-term aggregated statistics for an entity over a date/time range.' It names the resource (statistics for an entity) and the action (retrieve over a range), and distinguishes itself from the sibling `get_statistics` by clarifying it uses an explicit window. This clearly separates it from other tools like `get_history_range`.

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 provides a clear comparison to `get_statistics` (same data source but with explicit window) and includes concrete use case examples ('what was my power usage from Jan 1 to Jan 31?'). It also notes the data survival beyond short-term retention, implying when to use this tool for historical data. While it doesn't explicitly say 'when not to use', the contrast with `get_statistics` and the focus on long-term range queries provide strong guidance.

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