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 code sample shows how to use curl to call 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 |
Required. The name of the project to list alerts for. |
filter |
Optional. An alert is returned if there is a match on any fields belonging to the alert or its subfields. |
orderBy |
Optional. A comma-separated list of fields in
For example, If the field is not set, the results are sorted by |
pageSize |
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 |
Optional. If non-empty, |
Output Schema
The ListAlerts response.
ListAlertsResponse
| JSON representation |
|---|
{
"alerts": [
{
object ( |
| Fields | |
|---|---|
alerts[] |
The list of alerts. |
nextPageToken |
If not empty, indicates that there may be more results that match the request. Use the value in the |
totalSize |
The estimated total number of matching results for this query. |
Alert
| JSON representation |
|---|
{ "name": string, "state": enum ( |
| Fields | |
|---|---|
name |
Identifier. The name of the alert. The format is: The |
state |
Output only. The current state of the alert. |
openTime |
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: |
closeTime |
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: |
resource |
The monitored resource type and any monitored resource labels preserved from the incident's generating condition. |
metadata |
The metadata of the monitored resource. |
metric |
The metric type and any metric labels preserved from the incident's generating condition. |
log |
The log information associated with the alert. This field is only populated for log-based alerts. |
policy |
The snapshot of the alert policy that generated this alert. |
Timestamp
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
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 |
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 |
Required. The monitored resource type. This field must match the |
labels |
Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Compute Engine VM instances use the labels An object containing a list of |
LabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
MonitoredResourceMetadata
| JSON representation |
|---|
{ "systemLabels": { object }, "userLabels": { string: string, ... } } |
| Fields | |
|---|---|
systemLabels |
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: |
userLabels |
Output only. A map of user-defined metadata labels. An object containing a list of |
Struct
| JSON representation |
|---|
{ "fields": { string: value, ... } } |
| Fields | |
|---|---|
fields |
Unordered map of dynamically typed values. An object containing a list of |
FieldsEntry
| JSON representation |
|---|
{ "key": string, "value": value } |
| Fields | |
|---|---|
key |
|
value |
|
Value
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field kind. The kind of value. kind can be only one of the following: |
|
nullValue |
Represents a JSON |
numberValue |
Represents a JSON number. Must not be |
stringValue |
Represents a JSON string. |
boolValue |
Represents a JSON boolean ( |
structValue |
Represents a JSON object. |
listValue |
Represents a JSON array. |
ListValue
| JSON representation |
|---|
{ "values": [ value ] } |
| Fields | |
|---|---|
values[] |
Repeated field of dynamically typed values. |
UserLabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
Metric
| JSON representation |
|---|
{ "type": string, "labels": { string: string, ... } } |
| Fields | |
|---|---|
type |
An existing metric type, see |
labels |
The set of label values that uniquely identify this metric. All labels listed in the An object containing a list of |
LabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
LogMetadata
| JSON representation |
|---|
{ "extractedLabels": { string: string, ... } } |
| Fields | |
|---|---|
extractedLabels |
The labels extracted from the log. An object containing a list of |
ExtractedLabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
PolicySnapshot
| JSON representation |
|---|
{
"name": string,
"displayName": string,
"severity": enum ( |
| Fields | |
|---|---|
name |
The name of the alert policy resource. In the form of "projects/[PROJECT_ID_OR_NUMBER]/alertPolicies/[ALERT_POLICY_ID]". |
displayName |
The display name of the alert policy. |
severity |
The severity of the alert policy. |
userLabels |
The user labels for the alert policy. An object containing a list of |
UserLabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
State
The enumeration of possible states for an alert.
| Enums | |
|---|---|
STATE_UNSPECIFIED |
The alert state is unspecified. |
OPEN |
The alert is open. |
CLOSED |
The alert is closed. |
NullValue
Represents a JSON null.
NullValue is a sentinel, using an enum with only one value to represent the null value for the Value type union.
A field of type NullValue with any value other than 0 is considered invalid. Most ProtoJSON serializers will emit a Value with a null_value set as a JSON null regardless of the integer value, and so will round trip to a 0 value.
| Enums | |
|---|---|
NULL_VALUE |
Null value. |
Severity
An enumeration of possible severity level for an alerting policy.
| Enums | |
|---|---|
SEVERITY_UNSPECIFIED |
No severity is specified. This is the default value. |
CRITICAL |
This is the highest severity level. Use this if the problem could cause significant damage or downtime. |
ERROR |
This is the medium severity level. Use this if the problem could cause minor damage or downtime. |
WARNING |
This is the lowest severity level. Use this if the problem is not causing any damage or downtime, but could potentially lead to a problem in the future. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌