Tool: query_usage_histories
Returns daily historical usage time series for resources like Compute Engine (vCPUs, RAM, Local SSD, Persistent Disk, GPUs, and TPUs) and Cloud Storage bucket read throughput in a project, folder, or organization, at the regional or zonal level. Use this tool to analyze past consumption trends. Requires parent (for example, 'projects/{project}/locations/{location}', 'folders/{folder}/locations/{location}', or 'organizations/{organization}/locations/{location}') and cloudResourceType.
The following code sample shows how to use curl to call the query_usage_histories MCP tool.
| Curl Request |
|---|
curl --location 'https://capacityplanner.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "query_usage_histories", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The QueryUsageHistories request.
QueryUsageHistoriesRequest
| JSON representation |
|---|
{ "parent": string, "locationLevel": enum ( |
| Fields | |
|---|---|
parent |
Required. The project, folder, or organization and location for the time series values to return. The format is: |
locationLevel |
Optional. The location level (regional or zonal) of the usage time series to return. |
isSpot |
Optional. Whether to return usage data for Spot (preemptible) resources. |
machineFamily |
Optional. The machine family for the |
machineShape |
Optional. The machine shape for the |
diskType |
Optional. The disk_type for the |
confidentialMode |
Optional. Whether the persistent disk is in confidential mode. |
gpuType |
Optional. The GPU type for the |
tpuType |
Optional. The TPU type for the |
gcsBucketTraffic |
Optional. Cloud Storage bucket traffic resource for the |
cloudResourceType |
Required. The resource for the |
usageAggregationMethod |
Optional. The method that should be used to convert sampled usage data to daily usage values. AGGREGATION_METHOD_UNSPECIFIED will return results matching all the aggregation methods. |
startDate |
Optional. The start date of the usage history to return. |
endDate |
Optional. The end date of the usage history to return. |
MachineShape
| JSON representation |
|---|
{ "machineFamily": string, "machineType": string, "machineShape": string, "cpuCores": number, "gpuType": string, "gpuComputeType": string, "gpuCores": string, "localSsdPartitions": string, "localSsdGb": number, "memoryGb": number, "localSsdInterface": string, "minCpuPlatform": string } |
| Fields | |
|---|---|
machineFamily |
Optional. The VM family. |
machineType |
Optional. The characteristics of the sampled VM expressed as a string. |
machineShape |
Optional. The customer visible string representing the type of VM. |
cpuCores |
Optional. Number of CPU cores per VM. |
gpuType |
Optional. The type of GPU with the VM. |
gpuComputeType |
Optional. The GPU name recognized by Compute Engine APIs. |
gpuCores |
Optional. The number of GPU cores per VM. |
localSsdPartitions |
Optional. The number of local SSD partitions per VM. |
localSsdGb |
Optional. Total amount of local SSD storage. |
memoryGb |
Optional. Total amount of memory with the VM. |
localSsdInterface |
Optional. The local SSD interface used such as nvme or scsi |
minCpuPlatform |
Optional. The minimum CPU platform used, such as |
GcsBucketTraffic
| JSON representation |
|---|
{ "trafficPath": enum ( |
| Fields | |
|---|---|
trafficPath |
Optional. Path type for the Cloud Storage bucket traffic. |
bucketLocationType |
Optional. Location type of the Cloud Storage bucket. |
bucketLocation |
Optional. Location of the Cloud Storage bucket e.g. us-central1 (single region), us (multi region) and eur4 - europe-north1 and europe-west4 (dual region). |
Date
| JSON representation |
|---|
{ "year": integer, "month": integer, "day": integer } |
| Fields | |
|---|---|
year |
Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. |
month |
Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. |
day |
Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. |
LocationType
The type of location that the time series is summarizing.
| Enums | |
|---|---|
LOCATION_TYPE_UNSPECIFIED |
No location type was specified. |
REGIONAL |
Time series values represent usage aggregated at the region level. |
ZONAL |
Time series values represent usage aggregated at the zone level. |
TrafficPath
Path type for the Cloud Storage bucket traffic.
| Enums | |
|---|---|
TRAFFIC_PATH_UNSPECIFIED |
Unspecified traffic path. |
TRAFFIC_PATH_GOOGLE |
Traffic path through Google's network. |
TRAFFIC_PATH_INTERNET |
Traffic path through the internet. |
LocationType
Location type/level of the Cloud Storage bucket.
| Enums | |
|---|---|
LOCATION_TYPE_UNSPECIFIED |
Unspecified location type. |
LOCATION_TYPE_SINGLE_REGION |
Single region location type. |
LOCATION_TYPE_DUAL_REGION |
Dual region location type. |
LOCATION_TYPE_MULTI_REGION |
Multi region location type. |
AggregationMethod
Methods for converting sampled data to time series values.
| Enums | |
|---|---|
AGGREGATION_METHOD_UNSPECIFIED |
No aggregation method is specified. |
MEDIAN |
Deprecated: Use P50 instead. |
PEAK |
Deprecated: Use P99 instead. |
P50 |
Time series values represent the 50th(median) percentile of the sampled values. |
P75 |
Time series values represent the 75th percentile of the sampled values. |
P99 |
Time series values represent the 99th percentile of the sampled values. |
P100 |
Time series values represent the max of the sampled values. |
Output Schema
The QueryUsageHistories response.
QueryUsageHistoriesResponse
| JSON representation |
|---|
{
"usageHistories": [
{
object ( |
| Fields | |
|---|---|
usageHistories[] |
The usage histories that match the request. |
UsageHistory
| JSON representation |
|---|
{ "timeSeries": { object ( |
| Fields | |
|---|---|
timeSeries |
The collection of data points that represent the historical values. |
aggregationMethod |
Method used to convert sampled usage data to time series values. |
TimeSeries
| JSON representation |
|---|
{ "locationType": enum ( |
| Fields | |
|---|---|
locationType |
Required. The type of location that the time series is summarizing. |
location |
Optional. The location of the usage data in time series. |
isSpot |
Optional. Whether the time series represents usage of Spot (preemptible) resources. |
machineFamily |
The machine family for the time series values to return. Possible values include "n1" and "n2d". |
diskType |
The disk type for the time series values to return. |
confidentialMode |
Optional. The confidential mode for disk. |
gpuType |
The GPU type of the time series. |
tpuType |
The TPU type of the time series. |
machineShape |
The machine shape of the time series. |
gcsBucketTraffic |
Output only. The Cloud Storage bucket traffic resource for usage time series. |
cloudResourceType |
The resource for the time series values to return. Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-persistent-disk", "gce-gpu", "gce-tpu" and "gce-vm". |
points[] |
The data points of this time series. When listing time series, points are returned in chronological order. |
unit |
The units in which the values are reported. |
MachineShape
| JSON representation |
|---|
{ "machineFamily": string, "machineType": string, "machineShape": string, "cpuCores": number, "gpuType": string, "gpuComputeType": string, "gpuCores": string, "localSsdPartitions": string, "localSsdGb": number, "memoryGb": number, "localSsdInterface": string, "minCpuPlatform": string } |
| Fields | |
|---|---|
machineFamily |
Optional. The VM family. |
machineType |
Optional. The characteristics of the sampled VM expressed as a string. |
machineShape |
Optional. The customer visible string representing the type of VM. |
cpuCores |
Optional. Number of CPU cores per VM. |
gpuType |
Optional. The type of GPU with the VM. |
gpuComputeType |
Optional. The GPU name recognized by Compute Engine APIs. |
gpuCores |
Optional. The number of GPU cores per VM. |
localSsdPartitions |
Optional. The number of local SSD partitions per VM. |
localSsdGb |
Optional. Total amount of local SSD storage. |
memoryGb |
Optional. Total amount of memory with the VM. |
localSsdInterface |
Optional. The local SSD interface used such as nvme or scsi |
minCpuPlatform |
Optional. The minimum CPU platform used, such as |
GcsBucketTraffic
| JSON representation |
|---|
{ "trafficPath": enum ( |
| Fields | |
|---|---|
trafficPath |
Optional. Path type for the Cloud Storage bucket traffic. |
bucketLocationType |
Optional. Location type of the Cloud Storage bucket. |
bucketLocation |
Optional. Location of the Cloud Storage bucket e.g. us-central1 (single region), us (multi region) and eur4 - europe-north1 and europe-west4 (dual region). |
Point
| JSON representation |
|---|
{ "eventTime": string, "value": number } |
| Fields | |
|---|---|
eventTime |
The time which the data point applies. 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: |
value |
The value of the data point. |
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. |
LocationType
The type of location that the time series is summarizing.
| Enums | |
|---|---|
LOCATION_TYPE_UNSPECIFIED |
No location type was specified. |
REGIONAL |
Time series values represent usage aggregated at the region level. |
ZONAL |
Time series values represent usage aggregated at the zone level. |
TrafficPath
Path type for the Cloud Storage bucket traffic.
| Enums | |
|---|---|
TRAFFIC_PATH_UNSPECIFIED |
Unspecified traffic path. |
TRAFFIC_PATH_GOOGLE |
Traffic path through Google's network. |
TRAFFIC_PATH_INTERNET |
Traffic path through the internet. |
LocationType
Location type/level of the Cloud Storage bucket.
| Enums | |
|---|---|
LOCATION_TYPE_UNSPECIFIED |
Unspecified location type. |
LOCATION_TYPE_SINGLE_REGION |
Single region location type. |
LOCATION_TYPE_DUAL_REGION |
Dual region location type. |
LOCATION_TYPE_MULTI_REGION |
Multi region location type. |
AggregationMethod
Methods for converting sampled data to time series values.
| Enums | |
|---|---|
AGGREGATION_METHOD_UNSPECIFIED |
No aggregation method is specified. |
MEDIAN |
Deprecated: Use P50 instead. |
PEAK |
Deprecated: Use P99 instead. |
P50 |
Time series values represent the 50th(median) percentile of the sampled values. |
P75 |
Time series values represent the 75th percentile of the sampled values. |
P99 |
Time series values represent the 99th percentile of the sampled values. |
P100 |
Time series values represent the max of the sampled values. |
Tool Annotations
Tool annotations are sent to MCP clients to describe the basic risk of a given tool. Most clients treat these hints as untrusted, but they can be used to decide when a confirmation prompt might be sent to a user.
Along with the title string, the following boolean hints are defined as follows:
readOnlyHint: If true, the tool doesn't modify its environment. Default: false.destructiveHint: If true, then the tool can perform destructive actions. If false, then the tool can only perform additive actions. Default: true.idempotentHint: If true, then calling the tool repeatedly with the same arguments will have no additional effect on its environment. Default: false.openWorldHint: If true, then the tool can interact with an 'open world' of external entities. If false, then the tool can only interact with internal entities. For example, a web search tool would be open world, while a memory tool would not be open world.
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌