Manage a blend's custom metrics
manage_blend_metricsList, create, edit or delete the custom metrics (calculated fields) saved on a blend.
A custom metric is a formula over the blend's fields, saved once and usable in
query_blend, reports and exports like any other field. action is one of
list | create | update | delete.
createneedslabelandformula. Optional:kind(metric— default — ordimension),data_type(NUMBER for metrics; STRING or BOOLEAN for dimensions),default_aggregation(SUM, AVG, MAX, MIN, COUNT, COUNT_DISTINCT; metrics only),format(number|percent|currency_usdfor metrics,text|booleanfor dimensions) andformula_prompt(the user's own words, kept for reference).updateneedsmetric_idplus only what changes.deleteneedsmetric_idand is permanent — confirm with the user first.
Every write is validated before saving (syntax, that each referenced field exists
in this blend, type/aggregation coherence) and re-warms the blend schema. Each
metric comes back with name: pass that id in query_blend(fields=[...]).
Formula syntax (the engine's, exactly):
reference fields by their bare id from list_fields(connector=...)
(<connector>_<field>; unprefixed cross-connector ids only in blends with 2+
sources) or by another metric's name. Operators + - * /, comparisons
= != < <= > >=, AND OR NOT, IN ('a','b'), IS NULL, text in quotes.
Aggregations SUM AVG MAX MIN COUNT COUNT_DISTINCT; conditionals
IF(cond, a, b), IFNULL(x, 0), CASE WHEN … THEN … ELSE … END; functions
ABS SQRT ROUND CONCAT SUBSTR REGEXP_MATCH REGEXP_CONTAINS REGEXP_EXTRACT
REGEXP_REPLACE PARSE_DATE CURRENT_DATE FORMAT_DATE YEARWEEK WEEKDAY WEEK QUARTER
MONTH DAY TOCOUNTRY. Names are UPPERCASE. Write ratios as ratios of totals:
SUM(<connector>_cost) / SUM(<connector>_conversions), not cost / conversions.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"blend_id": "<blend_id>",
"action": "<action>"
},
"name": "manage_blend_metrics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | ||
| label | No | ||
| action | Yes | ||
| format | No | ||
| formula | No | ||
| blend_id | Yes | ||
| data_type | No | ||
| metric_id | No | ||
| formula_prompt | No | ||
| default_aggregation | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||