Skip to main content
Glama

Manage a blend's custom metrics

manage_blend_metrics
Destructive

List, 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.

  • create needs label and formula. Optional: kind (metric — default — or dimension), 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_usd for metrics, text|boolean for dimensions) and formula_prompt (the user's own words, kept for reference).

  • update needs metric_id plus only what changes. delete needs metric_id and 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

NameRequiredDescriptionDefault
kindNo
labelNo
actionYes
formatNo
formulaNo
blend_idYes
data_typeNo
metric_idNo
formula_promptNo
default_aggregationNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations (destructiveHint=true, openWorldHint=true), it discloses that every write is validated before saving (syntax, referenced field existence, type/aggregation coherence) and re-warms the blend schema, and that delete is permanent and should be confirmed with the user first. That is exactly the kind of side-effect and irreversibility context annotations alone cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

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

Front-loaded with the purpose and an action-keyed bullet list, then the formula grammar. The grammar block is long but dense and functional given there is no other documentation surface; a few items (the full function name list) could live in a reference doc rather than the tool description.

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?

Despite a mutation tool with 10 unannotated-in-schema parameters, the definition covers lifecycle, required inputs, validation behavior, irreversibility, and the formula language, plus how to consume the returned name in query_blend. With an output schema present, return-value detail is correctly omitted.

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% across 10 parameters, so the description must carry the burden and does: it enumerates the four action values, required versus optional parameters per action, the conditional allowed values for kind, data_type, default_aggregation and format, and the meaning of formula_prompt. Only blend_id is left implicit, which is self-evident from the tool name.

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?

Opens with a specific verb set and resource: "List, create, edit or delete the custom metrics (calculated fields) saved on a blend." The parenthetical clarifies the domain term and the definition contrasts the tool against the field-reading sibling by pointing to list_fields for field ids and query_blend for consumption.

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?

Gives per-action prerequisites (create needs label and formula, update needs metric_id plus only what changes, delete needs metric_id) and explicitly routes the agent elsewhere for field ids (list_fields) and for querying results (query_blend). It does not explicitly contrast with update_blend or say when not to create a metric versus a plain field, so it stops just short of a full routing rule.

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