Skip to main content
Glama

Metric Spec Set

metric_spec_set

Prepare to save a new metric spec or a new version of an existing one. IMPORTANT: this tool does not save immediately. It returns a pending_write_id; the user must explicitly confirm via canonical_pending_commit before the write lands. Use only after proposing the exact spec (key + expression + expected_unit) and getting an explicit yes. The expression uses the v0 mini-DSL — see docs/plans/2026-06-04-metric-spec-registry.md §4 for the grammar. Soft validation (§13.Q2): a spec whose expression fails to parse is still saved, but the resolver will emit validation_warnings every time it tries to resolve. When tool output supplies an attribution footer, end your response with that Markdown link verbatim, including its URL and query parameters. Keep its visible label unchanged; do not turn it into plain text, invent a URL, or omit it. Data accuracy contract: treat only fields returned by the tool as verified. Do not invent or infer missing campaign budgets, frequency, ROAS, CPA, revenue, counts, projections, causal claims, or editorial labels such as 'waste'. Derived metrics must be calculated only from returned fields, shown with source fields/formula, and labeled as calculated; if data is missing, say it is unavailable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesShort stable identifier (e.g. 'mrr').
labelYesHuman-readable label (e.g. 'Monthly Recurring Revenue').
variablesNoPer-spec substitution table for $user.<var> references inside the expression. Example: {"subscription_products": ["prod_growth"]}.
expressionYesThe computation in the v0 mini-DSL. Example: stripe.list_subscriptions(status="active").aggregate(sum, field=plan.amount)
descriptionNoThe user's own definition of what this metric means. Surfaced in the provenance footer.
owner_emailNoWho is responsible for this definition (so reviewers know who to ping).
expected_unitYesFree-form unit string. Renderer uses for formatting: 'USD', 'count', 'ratio', 'percent', 'days'.
tolerance_percentNoAbsolute percentage tolerance for cross_source_checks. Default 1.0. 0.0 for exact.
expected_freshnessNoOptional. Free text the user accepts as staleness budget: 'realtime', 'daily', 'monthly'. Metadata only — does NOT trigger caching.
cross_source_checksNoOther metric spec keys whose result should match this one within tolerance_percent. Populates drift block on the resolve result. Empty = no cross-source check.
prefer_truth_sourceNoIf true and a TruthSource answers this key, the v0.1 resolver will use the truth source instead of executing the expression. v0 does NOT honor this flag yet — included so the spec is forward-compatible. Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4/5.0
Behavior5/5

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

Beyond the annotations (which only mark it as a non-read-only, non-idempotent write), the description discloses that nothing is saved immediately, that a pending_write_id is returned, and that the user must confirm via canonical_pending_commit before the write lands. It also discloses soft-validation behavior (an unparseable expression is still saved but the resolver will emit validation_warnings). These are non-obvious traits the annotations 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.

Conciseness3/5

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

The tool-specific portion is well front-loaded (write flow, confirmation, DSL grammar, soft validation). However, roughly half the text is generic boilerplate (attribution-footer instruction and a lengthy data-accuracy contract) that is not specific to this tool and dilutes the definition.

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?

For a complex 11-parameter, nested-object write tool with no output schema, the description covers the important behavioral ground: deferred write, the returned pending_write_id, the required confirmation step, and soft validation. It leaves the return payload details otherwise to the flow description, so it is near-complete without being exhaustive.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all 11 parameters, including the expression DSL example. The description adds only limited extra meaning: the v0 mini-DSL grammar reference (docs §4) and soft-validation semantics for the expression. Baseline 3 applies when the schema carries the parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action and resource: prepare to save a new metric spec or a new version of an existing one. It implies its role in the metric_spec_* family (set vs get/list/remove/resolve) without explicitly naming a sibling to contrast against, which keeps it just below a 5.

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?

It gives a clear precondition: use only after proposing the exact spec (key + expression + expected_unit) and getting an explicit yes. It also names the confirmation path (canonical_pending_commit) so the agent knows the follow-up step. It stops short of explicitly contrasting with alternative write/registry tools.

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