MCP Tools Reference: monitoring.googleapis.com

Tool: list_alerts

Use this as the primary tool to list the alerts in a Google Cloud project. An alert is the representation of a violation of an alert policy. This is useful for understanding current and past violations of an alert policy.

The following sample demonstrate how to use curl to invoke the list_alerts MCP tool.

Curl Request
                  
curl --location 'https://monitoring.googleapis.com/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "list_alerts",
    "arguments": {
      // provide these details according to the tool's MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

Input Schema

The ListAlerts request.

ListAlertsRequest

JSON representation
{
  "parent": string,
  "filter": string,
  "orderBy": string,
  "pageSize": integer,
  "pageToken": string
}
Fields
parent

string

Required. The name of the project to list alerts for.

filter

string

Optional. An alert is returned if there is a match on any fields belonging to the alert or its subfields.

orderBy

string

Optional. A comma-separated list of fields in Alert to use for sorting. The default sort direction is ascending. To specify descending order for a field, add a desc modifier. The following fields are supported:

  • open_time
  • close_time

For example, close_time desc, open_time will return the alerts closed most recently, with ties broken in the order of older alerts listed first.

If the field is not set, the results are sorted by open_time desc.

pageSize

integer

Optional. The maximum number of results to return in a single response. If not set to a positive number, at most 50 alerts will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

pageToken

string

Optional. If non-empty, page_token must contain a value returned as the next_page_token in a previous response to request the next set of results.

Output Schema

The ListAlerts response.

ListAlertsResponse

JSON representation
{
  "alerts": [
    {
      object (Alert)
    }
  ],
  "nextPageToken": string,
  "totalSize": integer
}
Fields
alerts[]

object (Alert)

The list of alerts.

nextPageToken

string

If not empty, indicates that there may be more results that match the request. Use the value in the page_token field in a subsequent request to fetch the next set of results. The token is encrypted and only guaranteed to return correct results for 72 hours after it is created. If empty, all results have been returned.

totalSize

integer

The estimated total number of matching results for this query.

Alert

JSON representation
{
  "name": string,
  "state": enum (State),
  "openTime": string,
  "closeTime": string,
  "resource": {
    object (MonitoredResource)
  },
  "metadata": {
    object (MonitoredResourceMetadata)
  },
  "metric": {
    object (Metric)
  },
  "log": {
    object (LogMetadata)
  },
  "policy": {
    object (PolicySnapshot)
  }
}
Fields
name

string

Identifier. The name of the alert.

The format is:

projects/[PROJECT_ID_OR_NUMBER]/alerts/[ALERT_ID]

The [ALERT_ID] is a system-assigned unique identifier for the alert.

state

enum (State)

Output only. The current state of the alert.

openTime

string (Timestamp format)

The time when the alert was opened.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

closeTime

string (Timestamp format)

The time when the alert was closed.

Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

resource

object (MonitoredResource)

The monitored resource type and any monitored resource labels preserved from the incident's generating condition.

metadata

object (MonitoredResourceMetadata)

The metadata of the monitored resource.

metric

object (Metric)

The metric type and any metric labels preserved from the incident's generating condition.

log

object (LogMetadata)

The log information associated with the alert. This field is only populated for log-based alerts.

policy

object (PolicySnapshot)

The snapshot of the alert policy that generated this alert.

Timestamp

JSON representation
{
  "seconds": string,
  "nanos": integer
}
Fields
seconds

string (int64 format)

Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z).

nanos

integer

Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive.

MonitoredResource

JSON representation
{
  "type": string,
  "labels": {
    string: string,
    ...
  }
}
Fields
type

string

Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Compute Engine VM instance is gce_instance. For a list of types, see Monitoring resource types and Logging resource types.

labels

map (key: string, value: string)

Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Compute Engine VM instances use the labels "project_id", "instance_id", and "zone".

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

LabelsEntry

JSON representation
{
  "key": string,
  "value": string
}
Fields
key

string

value

string

MonitoredResourceMetadata

JSON representation
{
  "systemLabels": {
    object
  },
  "userLabels": {
    string: string,
    ...
  }
}
Fields
systemLabels

object (Struct format)

Output only. Values for predefined system metadata labels. System labels are a kind of metadata extracted by Google, including "machine_image", "vpc", "subnet_id", "security_group", "name", etc. System label values can be only strings, Boolean values, or a list of strings. For example:

{ "name": "my-test-instance",
  "security_group": ["a", "b", "c"],
  "spot_instance": false }
userLabels

map (key: string, value: string)

Output only. A map of user-defined metadata labels.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

Struct

JSON representation
{
  "fields": {
    string: value,
    ...
  }
}
Fields
fields

map (key: string, value: value (Value format))

Unordered map of dynamically typed values.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

FieldsEntry

JSON representation
{
  "key": string,
  "value": value
}
Fields
key

string

value

value (Value format)

Value

JSON representation
{

  // Union field kind can be only one of the following:
  "nullValue": null,
  "numberValue": number,
  "stringValue": string,
  "boolValue": boolean,
  "structValue": {
    object
  },
  "listValue": array
  // End of list of possible types for union field kind.
}
Fields
Union field kind. The kind of value. kind can be only one of the following:
nullValue

null

Represents a null value.

numberValue

number

Represents a double value.

stringValue

string

Represents a string value.

boolValue

boolean

Represents a boolean value.

structValue

object (Struct format)

Represents a structured value.

listValue

array (ListValue format)

Represents a repeated Value.

ListValue

JSON representation
{
  "values": [
    value
  ]
}
Fields
values[]

value (Value format)

Repeated field of dynamically typed values.

UserLabelsEntry

JSON representation
{
  "key": string,
  "value": string
}
Fields
key

string

value

string

Metric

JSON representation
{
  "type": string,
  "labels": {
    string: string,
    ...
  }
}
Fields
type

string

An existing metric type, see google.api.MetricDescriptor. For example, custom.googleapis.com/invoice/paid/amount.

labels

map (key: string, value: string)

The set of label values that uniquely identify this metric. All labels listed in the MetricDescriptor must be assigned values.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

LabelsEntry

JSON representation
{
  "key": string,
  "value": string
}
Fields
key

string

value

string

LogMetadata

JSON representation
{
  "extractedLabels": {
    string: string,
    ...
  }
}
Fields
extractedLabels

map (key: string, value: string)

The labels extracted from the log.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

ExtractedLabelsEntry

JSON representation
{
  "key": string,
  "value": string
}
Fields
key

string

value

string

PolicySnapshot

JSON representation
{
  "name": string,
  "displayName": string,
  "severity": enum (Severity),
  "userLabels": {
    string: string,
    ...
  }
}
Fields
name

string

The name of the alert policy resource. In the form of "projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]".

displayName

string

The display name of the alert policy.

severity

enum (Severity)

The severity of the alert policy.

userLabels

map (key: string, value: string)

The user labels for the alert policy.

An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

UserLabelsEntry

JSON representation
{
  "key": string,
  "value": string
}
Fields
key

string

value

string

Tool Annotations

Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌