Skip to main content
Glama
homeassistant-ai

Home Assistant MCP Server

Official

Get Logs

ha_get_logs
Read-onlyIdempotent

Retrieve Home Assistant logs from logbook, system, error logs, add-ons, system services, or logger. Filter by level, search keyword, entity, time range, and sort order.

Instructions

Get Home Assistant logs from various sources.

Sources:

  • "logbook" (default): Entity state change history with pagination

  • "system": Structured system log entries (errors, warnings) via system_log/list

  • "error_log": Raw home-assistant.log text

  • "supervisor": Add-on container logs (requires slug = add-on slug)

  • "system_service": HA-Supervisor-managed system service logs (requires slug ∈ {supervisor, host, core, dns, audio, cli, multicast, observer})

  • "logger": Effective log level per integration via logger/log_info (confirms logger.set_level changes took effect)

Shared params: limit, search (keyword filter on entries/lines; matches integration domain for source='logger') Order: order='newest' (default) returns most-recent first; order='oldest' returns chronological-first. Applies to all time-ordered sources (logbook, system, error_log, supervisor, system_service); ignored for source='logger'. For raw-text sources (error_log, supervisor, system_service) it sets the read direction of the most-recent window. Logbook params: hours_back, entity_id, end_time, offset, compact (default True — strips attribute dicts to save context) System/error_log params: level (ERROR, WARNING, INFO, DEBUG) Supervisor params: slug = add-on slug, e.g. "core_mosquitto" (use ha_get_addon() to list installed slugs) System-service params: slug = service name. The slug "supervisor" here means the Supervisor service's own logs, NOT an add-on with that name — the source param disambiguates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
slugNo
levelNo
limitNo
orderNoSort order for time-ordered sources (logbook, system, error_log, supervisor, system_service): 'newest' (default) returns most-recent first; 'oldest' returns chronological-first. Ignored for source='logger'.newest
offsetNo
searchNo
sourceNologbook
compactNo
end_timeNo
entity_idNo
hours_backNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

The description goes beyond annotations (readOnlyHint, idempotentHint) by detailing pagination, ordering behavior, default values, and source-specific behaviors (e.g., 'order' applies to time-ordered sources, ignored for 'logger'). It also explains that 'compact' strips attribute dicts and that 'slug' disambiguation is handled by the 'source' param. No contradictions with annotations.

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 and bullet points, making the dense information scannable. However, it is somewhat lengthy (8 paragraphs) and could be trimmed slightly without losing clarity. Every sentence adds value, but the overall length might overwhelm an agent.

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 11 parameters, no required fields, and an output schema present, the description covers all aspects: source selection, parameter applicability, default values, and ordering. It leaves no ambiguity about how to construct a valid request or interpret results.

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?

With only 9% schema description coverage, the description fully compensates by explaining all 11 parameters: source, slug, level, limit, order, offset, search, compact, end_time, entity_id, hours_back. It provides context-specific semantics (e.g., 'search' matches integration domain for source='logger', 'order' sets read direction for raw-text sources).

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 clearly states it gets HA logs from six distinct sources, each with a specific purpose (e.g., 'logbook' for state change history, 'system' for structured errors). This verb-resource pairing is specific and differentiates from sibling tools like ha_get_history, which likely retrieves historical state changes rather than log sources.

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?

The description provides detailed guidance on when to use each source (e.g., 'supervisor' requires a slug, 'logger' confirms level changes). It shares common parameters and notes that some params are source-specific. However, it does not explicitly mention when to avoid this tool in favor of siblings or provide negative examples.

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/homeassistant-ai/ha-mcp'

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