Skip to main content
Glama
TheWhykiki

hass-mcp

by TheWhykiki

ha_get_logbook

Retrieve Home Assistant logbook entries from a specified start time, with optional filtering by entity ID.

Instructions

Fetch logbook entries since an ISO time (optionally for an entity).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sinceYes
endNo
entity_idNo

Implementation Reference

  • src/index.ts:181-191 (registration)
    Registration of the 'ha_get_logbook' tool with server.tool(), including name, description, schema (GetLogbookInput.shape), and the async handler that calls ha.getLogbook(input).
    server.tool(
      'ha_get_logbook',
      'Fetch logbook entries since an ISO time (optionally for an entity).',
      GetLogbookInput.shape,
      async (input) => {
        const res = await ha.getLogbook(input)
        return {
          content: [{ type: 'text', text: JSON.stringify(res, null, 2) }],
        }
      },
    )
  • Implementation of getLogbook() method on the HomeAssistantClient class. Constructs query parameters (entity, end_time) and calls the Home Assistant REST API endpoint /api/logbook/{since}.
    async getLogbook(params: {
      since: string
      end?: string
      entity_id?: string
    }) {
      const qs = new URLSearchParams()
      if (params.entity_id)
        qs.set('entity', params.entity_id)
      if (params.end)
        qs.set('end_time', params.end)
    
      const q = qs.toString()
      return await this.restRequest(`/api/logbook/${encodeURIComponent(params.since)}${q ? `?${q}` : ''}`)
    }
  • Zod schema definition for GetLogbookInput: requires 'since' (string), optional 'end' (string) and 'entity_id' (string).
    export const GetLogbookInput = z.object({
      since: z.string().min(1),
      end: z.string().min(1).optional(),
      entity_id: z.string().min(1).optional(),
    })
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It discloses the basic operation (fetching logbook entries) but does not reveal behavioral traits like read-only nature (implied but not explicit), permission requirements, response format, or pagination limits. The description is insufficient for an agent to understand side effects or constraints.

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

Conciseness3/5

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

The description is a single sentence of 20 words, which is concise. However, it omits important details like return value structure and parameter formats, making it somewhat under-specified. It is not verbose, but could be more informative without sacrificing conciseness.

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

Completeness2/5

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

Given three parameters, no output schema, and no annotations, the description is incomplete. It does not explain what a logbook entry contains, error scenarios, time format restrictions, or ordering. An agent using this tool would need to infer too much.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/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 adds context for 'since' (ISO time) and 'entity_id' (optional entity), but does not explain 'end' parameter meaning or expected format. With three parameters and no schema descriptions, the description provides only minimal added value.

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 'Fetch logbook entries since an ISO time (optionally for an entity)' clearly states the verb (Fetch), resource (logbook entries), and conditions (since an ISO time, optional entity filter). It distinguishes from sibling tools like ha_get_history (which retrieves state history) and ha_get_error_logs (error-specific logs).

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives such as ha_get_history or ha_list_states. There is no mention of prerequisites, exclusions, or context-specific recommendations.

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

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