Skip to main content
Glama

wals.pro AI 4 weclapp

Aggregate entities

aggregate_entities
Read-onlyIdempotent

Count, sum, or group records of any weclapp entity server-side, returning only the aggregate — the tool for "how many …", "revenue per month", "top customers", and any report-style question. Never page raw rows through search_entities to compute a total.

Args: entity: weclapp entity name (same allowlist as search_entities). metrics: List of "count" (default) and/or ":" with op sum/avg/min/max over a top-level numeric field, e.g. ["count", "sum:grossAmount"]. Amounts return as decimal strings. Prefer the "*InCompanyCurrency" amount fields — sums over plain amount fields are split per currency. filters: Same typed conditions as search_entities ({"field", "op", "value"}; ISO dates auto-convert). group_by: Optional top-level field to group by, e.g. "customerId", "status", or a date field like "invoiceDate". Line items: a dotted "." folds nested items server-side, e.g. entity="salesInvoice", group_by="salesInvoiceItems.articleId", metrics=["sum:salesInvoiceItems.quantity"] (also orderItems, quotationItems, purchaseOrderItems, purchaseInvoiceItems). warehouseStockMovement accepts group_by="warehouseId". date_bucket: "month", "quarter", or "year" — required bucketing when group_by is a date field ("2026-03", "2026-Q1", "2026"). top: Max groups returned (default 20, cap 1,000), sorted by the first metric descending.

Returns: Ungrouped: {"total_matching", "metrics": {...}}. Grouped: {"total_matching", "groups": [{"key", "label"?, ...metrics, "currency"?}], "groups_total", "sorted_by"}. Plus "scanned_rows", "complete", and "skipped_non_numeric" (non-numeric rows, never folded into a sum).

More than 50,000 matching rows aborts with an error before any scan — narrow the filters (e.g. aggregate per year) and re-run. counts alone (metrics=["count"], no group_by) are a single cheap /count call with no row scan at any size.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNo
entityYes
filtersNo
metricsNo
group_byNo
date_bucketNo
correlation_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A5/5.0
Behavior5/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint=false, but the description adds substantial behavioral detail beyond that: the 50,000-row abort error with a recommendation to narrow filters, the performance note that counts alone are a cheap /count call with no row scan, the currency-splitting behavior for sums over plain amount fields, and the return structure including skipped_non_numeric and complete flags. 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.

Conciseness5/5

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

The description is long but every section earns its place. It front-loads the purpose and usage in the first sentence, then uses structured Args and Returns sections to organize parameter details, examples, and edge cases. There is no fluff; each sentence adds either a constraint, a clarification, or an example. The density is appropriate for the tool's complexity.

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 the tool's complexity (7 parameters, nested line-item grouping, date bucketing, currency handling) and the fact that the input schema provides no descriptions, the description is remarkably complete. It covers the return format, the abort threshold, performance characteristics, and gives concrete examples for tricky cases like line-item folding. An agent would have everything needed to select and invoke this tool correctly.

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% – the input schema provides no descriptions for any parameter. The description fully compensates: it explains entity (same allowlist as search_entities), metrics syntax with examples ("count", "sum:grossAmount"), filters format, group_by semantics including dotted line-item paths and special warehouseStockMovement handling, date_bucket options, and top default/cap. It also clarifies return-value details like decimal strings and currency fields. This is essential because the schema is bare.

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 opens with a precise verb-resource-scope: 'Count, sum, or group records of any weclapp entity server-side, returning only the aggregate'. It explicitly names the report-style questions it answers and immediately contrasts itself with search_entities ('Never page raw rows through search_entities to compute a total'), making sibling differentiation unambiguous.

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 first paragraph tells an agent exactly when to use this tool ('how many …', 'revenue per month', 'top customers', and any report-style question') and when not to (never page raw rows through search_entities). It explicitly names the alternative tool, giving clear routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources