Skip to main content
Glama
Samarth GTM MCP Server

Samarth GTM MCP Server

Official

ga4_create_calculated_metric

Create a GA4 calculated metric to turn custom formulas, like revenue per session, into reportable metrics; write access and explicit confirmation are required.

Instructions

[GA4 WRITE] Create a calculated metric (calculatedMetricId is required). 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": {
      "property": "<property>",
      "calculatedMetricId": "<calculatedMetricId>",
      "confirm": "<confirm>"
    },
    "name": "ga4_create_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.
confirmYesMust be true to apply the change.
formulaNoThe calculation formula, e.g. "{{purchase_revenue}} / {{sessions}}".
propertyYesGA4 property ID, e.g. "123456789" or "properties/123456789".
metricUnitNo
displayNameNo
calculatedMetricIdYesThe user-chosen id for the calculated metric (used in reporting): 1-80 letters, digits or "_".

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv1.497.5
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / body / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • changedInput schema / properties / calculatedMetricId / description
      Previous value: -"The user-chosen id for the calculated metric (used in reporting)."New value: +"The user-chosen id for the calculated metric (used in reporting): 1-80 letters, digits or \"_\"."
    • removedInput schema / properties / calculatedMetricId / minLength
      Removed value: -1
    • addedInput schema / properties / calculatedMetricId / pattern
      Added value: +"^[A-Za-z0-9_]{1,80}$"
    • removedInput schema / properties / property / minLength
      Removed value: -1
    • addedInput schema / properties / property / pattern
      Added value: +"^\\s*(properties\\/)?\\d+\\s*$"
  2. Addedv1.421.0
  3. Removedv1.350.0
  4. Addedv1.160.0

TDQS

A3.9/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does meaningfully disclose behavior: this is a mutating write, it is behind an environment-flag gate, and it needs an explicit confirm=true guard. It does not cover what happens on a duplicate calculatedMetricId, whether the call is idempotent, or error behavior, which keeps it below a 5 for a 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 short sentences with zero filler; the write marker and the required-id constraint are front-loaded ahead of the gating requirements. Every clause contains information an agent needs before calling.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter mutation with a nested raw-body object and no output schema and no annotations, the description covers the write gating but leaves the body-over-typed-fields merge precedence, optional-field defaults, and any success/failure signal unaddressed. That is adequate but has visible gaps given the tool's complexity.

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 71%, so the schema already documents confirm, formula, property, calculatedMetricId and the raw body merge. The description only repeats that calculatedMetricId is required, adding essentially no meaning beyond the structured fields, notably leaving metricUnit and displayName unexplained.

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?

States a specific verb and resource ('Create a calculated metric') and flags the write intent with a '[GA4 WRITE]' prefix, which cleanly separates it from the delete/update calculated-metric siblings. It stops short of naming any sibling or stating a scope boundary explicitly, so it is clear but not fully differentiated.

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 concrete invocation prerequisites: GA4_MCP_ENABLE_WRITES=true and confirm=true, plus a note that calculatedMetricId is required. There is no when-to-use/when-not guidance or routing to alternatives such as ga4_update_calculated_metric, so it lands at clear-context-without-exclusions rather than a 5.

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