Skip to main content
Glama

Draft an Analytics custom metric

draft_ga4_custom_metric
Destructive

Draft registering, changing or archiving a GA4 custom metric, returning a PREVIEW.

Registering makes a numeric event parameter reportable as a metric. The draft refuses a parameter that is already registered, a taken display name and a full property (see list_ga4_custom_definitions), and the preview warns that GA4 fills the metric only from now on. Update changes display_name, description, measurement_unit or restricted_metric_type; archive removes it from reports, cannot be undone and needs a double confirmation. Nothing changes until confirm_and_apply applies it. GA4 Admin API (customMetrics).

Google Analytics Data API: https://developers.google.com/analytics/devguides/reporting/data/v1 and Admin API: https://developers.google.com/analytics/devguides/config/admin/v1

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "draft_ga4_custom_metric"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionNo"create" (default), "update" or "archive".create
descriptionNoUp to 150 characters. On update, "" clears it.
property_idNoNumeric GA4 property ID, with or without the "properties/" prefix. If empty, uses the default from config.
display_nameNoName shown in GA4; defaults to parameter_name on create.
custom_metricNoResource name, instead of parameter_name, for update or archive.
parameter_nameNoThe numeric event parameter exactly as sent, e.g. "discount_amount". Required for create; identifies the metric for update and archive.
measurement_unitNoSTANDARD (default on create), CURRENCY, FEET, METERS, KILOMETERS, MILES, MILLISECONDS, SECONDS, MINUTES or HOURS.
restricted_metric_typeNoFor CURRENCY metrics, required: ["COST_DATA"] or ["REVENUE_DATA"] (or both).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations declare destructiveHint and openWorldHint, but the description adds genuinely new behavior: the output is a PREVIEW, drafts are refused for already-registered parameters, taken display names and full properties, GA4 backfills the metric only from now on, and archive cannot be undone and needs double confirmation. That is far more than the annotations 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?

The preview/confirm model is front-loaded and the sentence-per-action structure is easy to parse. The opening 'Draft registering, changing or archiving' is slightly awkward, and the trailing Google API documentation links add bulk with limited decision value, though they do ground the resource type.

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?

Output schema exists, so return values need not be explained, and everything else an agent needs is present: all three actions, the confirm gate, refusal conditions, irreversibility of archive and the API surface. Nothing essential to correct invocation is missing for an 8-parameter drafting tool.

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 coverage is 100%, so the baseline is 3; the description earns one more by explaining action-dependent relevance that the flat schema cannot express, namely that update touches display_name, description, measurement_unit and restricted_metric_type while create keys off parameter_name. It still leaves some param-level detail (length limits, action/param interactions for custom_metric vs parameter_name) to the schema.

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 opening sentence names a specific verb family (draft registering, changing or archiving) and a precise resource (GA4 custom metric) that is clearly distinct from the sibling draft_ga4_custom_dimension. Each of the three actions is then defined in concrete terms (registering makes a numeric event parameter reportable; update changes four named fields; archive removes from reports).

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 routes the agent well: nothing takes effect until confirm_and_apply applies it, and list_ga4_custom_definitions is named as the way to check whether a property is full. It does not state explicit exclusions (e.g. when to pick draft_ga4_custom_dimension instead) or say which action to prefer in ambiguous cases, leaving a small gap.

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.