Tool: get_metadata
Returns metadata for dimensions and metrics available in reporting methods.
The following sample demonstrate how to use curl to invoke the get_metadata MCP tool.
| Curl Request |
|---|
curl --location 'https://analyticsdata.googleapis.com/mcp/v1' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "get_metadata", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request for a property's dimension and metric metadata.
GetMetadataRequest
| JSON representation |
|---|
{ "name": string } |
| Fields | |
|---|---|
name |
Required. The resource name of the metadata to retrieve. This name field is specified in the URL path and not URL parameters. Property is a numeric Google Analytics property identifier. To learn more, see where to find your Property ID. Example: properties/1234/metadata Set the Property ID to 0 for dimensions and metrics common to all properties. In this special mode, this method will not return custom dimensions and metrics. |
Output Schema
The dimensions, metrics and comparisons currently accepted in reporting methods.
Metadata
| JSON representation |
|---|
{ "name": string, "dimensions": [ { object ( |
| Fields | |
|---|---|
name |
Resource name of this metadata. |
dimensions[] |
The dimension descriptions. |
metrics[] |
The metric descriptions. |
comparisons[] |
The comparison descriptions. |
DimensionMetadata
| JSON representation |
|---|
{ "apiName": string, "uiName": string, "description": string, "deprecatedApiNames": [ string ], "customDefinition": boolean, "category": string } |
| Fields | |
|---|---|
apiName |
This dimension's name. Useable in Dimension's |
uiName |
This dimension's name within the Google Analytics user interface. For example, |
description |
Description of how this dimension is used and calculated. |
deprecatedApiNames[] |
Still usable but deprecated names for this dimension. If populated, this dimension is available by either |
customDefinition |
True if the dimension is custom to this property. This includes user, event, & item scoped custom dimensions; to learn more about custom dimensions, see https://support.google.com/analytics/answer/14240153. This also include custom channel groups; to learn more about custom channel groups, see https://support.google.com/analytics/answer/13051316. |
category |
The display name of the category that this dimension belongs to. Similar dimensions and metrics are categorized together. |
MetricMetadata
| JSON representation |
|---|
{ "apiName": string, "uiName": string, "description": string, "deprecatedApiNames": [ string ], "type": enum ( |
| Fields | |
|---|---|
apiName |
A metric name. Useable in Metric's |
uiName |
This metric's name within the Google Analytics user interface. For example, |
description |
Description of how this metric is used and calculated. |
deprecatedApiNames[] |
Still usable but deprecated names for this metric. If populated, this metric is available by either |
type |
The type of this metric. |
expression |
The mathematical expression for this derived metric. Can be used in Metric's |
customDefinition |
True if the metric is a custom metric for this property. |
blockedReasons[] |
If reasons are specified, your access is blocked to this metric for this property. API requests from you to this property for this metric will succeed; however, the report will contain only zeros for this metric. API requests with metric filters on blocked metrics will fail. If reasons are empty, you have access to this metric. To learn more, see Access and data-restriction management. |
category |
The display name of the category that this metrics belongs to. Similar dimensions and metrics are categorized together. |
ComparisonMetadata
| JSON representation |
|---|
{ "apiName": string, "uiName": string, "description": string } |
| Fields | |
|---|---|
apiName |
This comparison's resource name. Useable in Comparison's |
uiName |
This comparison's name within the Google Analytics user interface. |
description |
This comparison's description. |
MetricType
A metric's value type.
| Enums | |
|---|---|
METRIC_TYPE_UNSPECIFIED |
Unspecified type. |
TYPE_INTEGER |
Integer type. |
TYPE_FLOAT |
Floating point type. |
TYPE_SECONDS |
A duration of seconds; a special floating point type. |
TYPE_MILLISECONDS |
A duration in milliseconds; a special floating point type. |
TYPE_MINUTES |
A duration in minutes; a special floating point type. |
TYPE_HOURS |
A duration in hours; a special floating point type. |
TYPE_STANDARD |
A custom metric of standard type; a special floating point type. |
TYPE_CURRENCY |
An amount of money; a special floating point type. |
TYPE_FEET |
A length in feet; a special floating point type. |
TYPE_MILES |
A length in miles; a special floating point type. |
TYPE_METERS |
A length in meters; a special floating point type. |
TYPE_KILOMETERS |
A length in kilometers; a special floating point type. |
BlockedReason
Justifications for why this metric is blocked.
| Enums | |
|---|---|
BLOCKED_REASON_UNSPECIFIED |
Will never be specified in API response. |
NO_REVENUE_METRICS |
If present, your access is blocked to revenue related metrics for this property, and this metric is revenue related. |
NO_COST_METRICS |
If present, your access is blocked to cost related metrics for this property, and this metric is cost related. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ✅