Skip to main content
Glama

Evaluate Expression

evaluate_expression
Read-only

Evaluate QGIS expressions to compute scalar values like aggregates, project variables, or dates. Optionally include a layer for context.

Instructions

Evaluate a standalone QGIS expression to a scalar value (e.g. aggregate('layer','sum','field'), @project_var, now()). Optional layer_id adds layer scope. Distinct from validate_expression (validate only) and field_calculator (per-feature).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
layer_idNo
expressionYes
Behavior4/5

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

Annotations already indicate readOnlyHint=true, so the description adds value by explaining that the tool evaluates to a scalar value and providing examples of supported expressions (aggregates, project variables, dates). It does not detail potential errors or return value types, but these are implied.

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 extremely concise: two sentences that first state the purpose, then differentiate from siblings. Every word contributes to clarity without redundancy.

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?

Given no output schema, the description adequately explains the result is a scalar value and gives examples. It does not cover error handling or edge cases, but for a straightforward read-only evaluator, this is sufficient. The differentiation from siblings adds completeness.

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

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, but the description explains that 'expression' is a standalone QGIS expression and 'layer_id' is optional and adds layer scope. This adds meaningful context beyond the schema's raw properties.

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 uses the verb 'evaluate' and specifies the resource 'QGIS expression', clearly indicating the tool's action. It distinguishes itself from siblings 'validate_expression' and 'field_calculator' by explaining their different purposes.

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 states when to use this tool versus alternatives: it evaluates expressions to scalar values, while 'validate_expression' only validates and 'field_calculator' operates per-feature. This provides clear usage context.

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/lefcgis/qgis-mcp'

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