Skip to main content
Glama
Samarth GTM MCP Server

Samarth GTM MCP Server

Official

ga4_update_calculated_metric

Update a GA4 calculated metric's formula, display name, or unit by passing only changed fields; writes require confirm=true and write access enabled.

Instructions

[GA4 WRITE] Update a calculated metric (formula/displayName/unit via fields or body). Pass only the fields to change; updateMask is derived from them (override with an explicit updateMask for nested paths). Requires GA4_MCP_ENABLE_WRITES=true and confirm=true.

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": {
      "name": "<name>",
      "confirm": "<confirm>"
    },
    "name": "ga4_update_calculated_metric"
  }
}

Input Schema

NameRequiredDescriptionDefault
bodyNoRaw request-body object (JSON) merged OVER the typed fields — use for nested/advanced fields not exposed as flat args.
nameYesFull resource name of the calculated metric to target: "properties/{property}/calculatedMetrics/{id}".
confirmYesMust be true to apply the change.
formulaNo
metricUnitNo
updateMaskNoComma-separated field paths to update. Omit to derive from the supplied fields.
displayNameNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.497.5
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / body / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • changedInput schema / properties / name / description
      Previous value: -"Full resource name of the calculated metric to target, e.g. \"properties/123/…/456\"."New value: +"Full resource name of the calculated metric to target: \"properties/{property}/calculatedMetrics/{id}\"."
    • removedInput schema / properties / name / minLength
      Removed value: -1
    • addedInput schema / properties / name / pattern
      Added value: +"^\\s*properties\\/\\d+\\/calculatedMetrics\\/[A-Za-z0-9_-]+\\s*$"
  2. Addedv1.421.0
  3. Removedv1.350.0
  4. Addedv1.160.0

TDQS

A3.9/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the full behavioral burden, and it does disclose meaningful traits: a write gate via an environment variable, a mandatory confirm flag, partial-update semantics with a derived updateMask, and that body is merged OVER typed fields. It does not say what happens to unspecified fields, whether the change is reversible, what permissions are needed, or what a failure looks like — gaps that matter for an unannotated mutation tool.

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

Conciseness5/5

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

Two dense sentences of roughly 40 words, front-loaded with the [GA4 WRITE] tag so the destructive class is visible before anything else. Every clause carries either an operation constraint or a parameter rule, with no filler.

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 7-parameter mutation tool with a nested body object and no output schema, the description covers the critical call-time facts: write enablement, confirm, partial-update behavior, and mask derivation. Return-value behavior is exempt (no output schema), but error/permission semantics remain undocumented.

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

Parameters4/5

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

Schema description coverage is 57%, and the description compensates for the undocumented props by explaining the updateMask derivation rule and when to override it, plus how body interacts with the flat typed fields. The formula/metricUnit/displayName mapping is implied only as a slash-separated list, so the meaning of those three params is largely left to the schema.

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 opens with a bracketed operation tag and a specific verb+resource pair ("Update a calculated metric") and enumerates the mutable fields (formula/displayName/unit), which clearly separates it from ga4_create_calculated_metric and ga4_delete_calculated_metric. It does not explicitly contrast with the similarly named ga4_update_custom_metric sibling, leaving that distinction to the resource name alone.

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 concrete operating guidance: pass only the fields to change, use an explicit updateMask for nested paths, and satisfy two preconditions (GA4_MCP_ENABLE_WRITES=true and confirm=true). What is missing is routing guidance — it never states when to use this versus creating a new calculated metric or updating a different metric type.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools