Skip to main content
Glama

Create calculated metric

create_calculated_metric

Create a calculated metric — a custom KPI from a formula over other metrics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesMetric name (e.g. "CTR")
symbolYesDisplay format: numbers, decimal, % or currency
formulaYesFormula as an ARRAY of tokens in evaluation order. CTR = clicks ÷ impressions × 100 is: [{id:"t1",type:"METRIC",query:{datasource_id:"gadw",data_view:"ACCOUNT",metrics:[{value:"clicks"}]}}, {id:"t2",type:"OPERATOR",operator:"÷"}, {id:"t3",type:"METRIC",query:{datasource_id:"gadw",data_view:"ACCOUNT",metrics:[{value:"impressions"}]}}, {id:"t4",type:"OPERATOR",operator:"×"}, {id:"t5",type:"NUMBER",number:100}]

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoThe new calculated metric — id, name, formula and symbol.
successYesTrue when the call succeeded. A failure comes back as an error result instead.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "data": {
      +      "additionalProperties": {},
      +      "description": "The new calculated metric — id, name, formula and symbol.",
      +      "type": "object"
      +    },
      +    "success": {
      +      "description": "True when the call succeeded. A failure comes back as an error result instead.",
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "success"
      +  ],
      +  "type": "object"
      +}
  2. First observed

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, so the agent knows this is a write operation that is not destructive. The description adds the concept of a 'custom KPI from a formula over other metrics,' which clarifies the semantic behavior. However, it doesn't disclose details like whether the metric is immediately available, whether it can reference other calculated metrics, or what the response contains. With annotations covering the basic safety profile, a 3 is appropriate.

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?

The description is a single, efficient sentence that front-loads the core purpose. It earns its place by defining the resource type and its nature. It could arguably add a pointer to the formula example in the schema, but the current length is appropriate and not padded.

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?

The tool has a rich output schema and 100% schema description coverage, so the description doesn't need to explain return values or parameters. The formula parameter is complex, but the schema's example covers it thoroughly. The description is complete enough for an agent to understand the tool's purpose, though it could mention that formula tokens reference datasource metrics from describe_datasource.

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 three parameters (name, formula, symbol) in detail. The description adds the high-level concept of a 'formula over other metrics' but doesn't add meaning beyond the schema's extensive formula token documentation. The schema's formula example is particularly rich, so the description's contribution is minimal. Baseline 3 is correct.

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 states a specific verb ('Create') and resource ('calculated metric'), and defines it as 'a custom KPI from a formula over other metrics.' This clearly distinguishes it from sibling tools like add_calculated_metric_widget (which adds a widget to a page) and update_calculated_metric (which modifies an existing one).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for creating a calculated metric, and the schema's formula example shows how to construct one. However, it does not explicitly state when to use this tool versus alternatives like add_calculated_metric_widget or update_calculated_metric, nor does it mention prerequisites like needing datasource IDs from describe_datasource. The usage context is implied but not explicitly guided.

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