LiveRecoverVYG Developer Docs
MCPToolsCDP tools

Query Metrics

sum / avg / min / max over a property, for profiles or events

cdp_query_metrics

Computes numeric metrics — any of sum, avg, min, max — over one property for your brand's profiles or events. Optionally pass a condition to filter the population first. Call cdp_list_properties for the allowed property paths and condition vocabulary.

Read-only and scoped to your brand.

Parameters

NameTypeRequiredDescriptionDefault
item_typestringYesWhich store to aggregate over: profile or event.
propertystringYesThe numeric property path. Profiles allow properties.*; events allow properties.*, flattenedProperties.*, and timeStamp. e.g. properties.amount (event) or properties.totalSpend (profile). Must be allowlisted; scope/shopDomain paths are rejected.
metricsstring[]YesWhich metrics to compute — a non-empty subset of sum, avg, min, max.
conditionobjectNoA Unomi condition to filter the population before aggregating (allowlisted vocabulary only).

Scope/shopDomain property paths and condition predicates are rejected — the owning scope is enforced by the server.

Returns

  • itemType, property — echoed back.
  • metrics — the computed values, keyed like _sum, _avg, _min, _max, plus _count (the matched-item count). Over an empty population _avg/_min/_max come back as null (never Infinity) and _count is 0.
  • scope — your brand's shop domain.

Example prompts

What's the average total spend across my profiles?
Sum the amount on order_created events for last month

Notes

  • The brand scope is injected server-side, so the metric only ever covers your own items.
  • The property, metrics, and any condition are validated against the allowlist before the query runs; an invalid input returns a clear error and no query.
  • Aggregate queries are throttled — on a rate limit, the tool returns a clear rate-limit error.

On this page