Skip to main content
Glama

query_entities

Filter and query Home Assistant entities using CEL expressions. Pre-filter by domain, apply custom conditions on state and attributes, and control output format with lean or compact options.

Instructions

Query entities using CEL (Common Expression Language) expressions.

CEL context: entity_id (string), state (numeric if possible, else string), domain (string), attributes (dict).

Args: domain: Domain pre-filter (e.g. "sensor", "light") expression: CEL filter expression limit: Max entities (default: 50) lean: Minimal fields with domain-specific attrs (default: True) compact: Only entity_id/state/friendly_name (default: False)

CEL examples: domain="sensor", expression='state < 30 && attributes.device_class == "battery"' domain="light", expression='state == "on" && attributes.brightness < 50' expression='state == "unavailable" || state == "unknown"'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainNo
expressionNo
limitNo
leanNo
compactNo
Behavior3/5

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

No annotations exist, so the description must convey behavior. It implies read-only by 'Query entities', but does not explicitly state non-destructive nature, rate limits, or error handling. Acceptable for a query tool.

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 well-organized with bullet points for arguments and clear CEL examples, concise yet comprehensive, no wasted words.

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

Completeness3/5

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

No output schema is provided, and the description does not describe the return format or potential errors, leaving a gap in completeness for a tool with 5 parameters.

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 coverage is 0%, so description carries full burden. It thoroughly explains all 5 parameters with defaults, purpose, and examples, adding significant value beyond the schema.

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 queries entities using CEL expressions, with explicit context variables and examples, distinguishing it from sibling tools like list_entities (simple listing) and search_entities (likely text search).

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 context for when to use (complex filtering via CEL) and includes examples, but does not explicitly contrast with alternatives or give when-not-to-use 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/rmaher001/hass-mcp-plus'

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