Skip to main content
Glama
HiTechLabTN

hass-mcp

by HiTechLabTN

get_statistics

Get aggregated statistics for Home Assistant entities over any period, with mean, min, max values, to handle high-frequency data or data older than retention windows.

Instructions

Get long-term aggregated statistics for an entity over the last N hours.

Uses HA's recorder statistics (over WebSocket) — aggregated buckets (mean / min / max per period) that survive the short-term retention window. Use this instead of get_history when: - You want data older than the recorder's default 10-day window. - You want aggregated values rather than every individual change. - The entity is a high-frequency sensor (temperature, power) and raw history would be too many tokens.

Args: entity_id: The entity (must have a state_class HA records as statistics — measurement, total, total_increasing). hours: How far back from now. Defaults to 24. period: Bucket size — 5minute, hour, day, week, month. Defaults to hour.

Returns: entity_id, period, start_time, end_time, statistics (list of {start, end, mean, min, max, ...} points).

Examples: get_statistics("sensor.power_usage", hours=168, period="day") get_statistics("sensor.temperature", hours=24)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hoursNo
periodNohour
entity_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Since no annotations are provided, the description carries the transparency burden and handles it well: it explains the underlying mechanism (HA recorder statistics over WebSocket), the retention-window behavior, and the prerequisite state_class requirement. It does not explicitly state side-effect or rate-limit behavior, though 'Get' and the described mechanics clearly imply a read-only operation.

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 longer than average but is tightly organized into purpose, usage guidance, args, return shape, and examples. Every section contributes necessary information, and the key purpose and alternative guidance are front-loaded.

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 three-parameter statistics tool with no annotations, the description provides complete context: when to use it, all parameter details, the expected return structure, and two realistic examples. The output shape is described even though an output schema is present, making the tool self-contained.

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%, but the Args section fully compensates by documenting entity_id's required state_class values, hours' meaning and default, and period's allowed bucket sizes and default. This adds substantial meaning beyond the bare schema and gives the agent actionable constraints.

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 first sentence clearly states the tool's action ('Get'), resource type ('long-term aggregated statistics for an entity'), and scope ('over the last N hours'). It also explicitly contrasts with the get_history sibling by naming the alternative, making the purpose distinct.

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 'Use this instead of get_history when' and lists three concrete conditions: data older than the 10-day window, aggregate values needed, or high-frequency sensors with token-heavy raw history. This gives clear guidance on when this tool is preferred over a key sibling.

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