Tool: query_reservations
Returns Compute Engine reservation data (allocations and future reservations) in a project, folder, or organization, either as aggregated reserved and used time series or as per-reservation details. Use this tool to compare reserved capacity with actual usage or to list reservations. Requires parent (for example, 'projects/{project}/locations/{location}', 'folders/{folder}/locations/{location}', or 'organizations/{organization}/locations/{location}'), cloudResourceType, reservationType, and reservationDataLevel.
The following code sample shows how to use curl to call the query_reservations 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_reservations", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The QueryReservations request.
QueryReservationsRequest
| 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: projects/{project}/locations/{location} or organizations/{organization}/locations/{location} or folders/{folder}/locations/{location} |
locationLevel |
Optional. The location level of the reservations usage timeseries. |
machineFamily |
Optional. The machine family to use to select the aggregate reserved values to return. Possible values include "n1", and "n2d" etc. Empty machine_family will return results matching all machine families. |
machineShape |
Optional. The machine_shape as a filter to select matching reservations. |
gpuType |
Optional. The GPU type for the reserved values to return. Sample values are "nvidia-tesla-t4", and "nvidia-tesla-a100". See https://cloud.google.com/compute/docs/gpus for a list. Empty gpu_type will return results matching all GPUs. |
cloudResourceType |
Required. The resource for the reserved values to return. Possible values include "gce-vcpus", "gce-ram", "gce-local-ssd", "gce-gpu" and "gce-vm". |
reservationType |
Required. The type of reservations to return: allocations, future reservations, or both. Use |
shareType |
Optional. Types of share settings to filter reservations in response. If unspecified, all types are included. |
ownershipType |
Optional. Types of ownerships to filter reservations based on. In case of OWNED, it filters reservations which are owned by selected parent project/folder/organization. If unspecified, all types are included. |
reservationDataLevel |
Required. Reservations output data format. |
includeUnapprovedReservations |
Optional. Whether to include pending for approval reservations in the response. This field is only applicable for future reservations. |
aggregationMethod |
Optional. The aggregation method of the historical reservation usage. Must be unspecified when |
startDate |
Optional. The start date of reservations usage. If specified, |
endDate |
Optional. The end date of reservations usage. If specified, |
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 |
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. |
ReservationType
Type of the reservation
| Enums | |
|---|---|
RESERVATION_TYPE_UNSPECIFIED |
No reservation type specified. |
RESERVATION_TYPE_ALLOCATION |
Allocation refers to realized reservation either auto created or created by the users on demand. |
RESERVATION_TYPE_FUTURE_RESERVATION |
Future Reservation requests created by users. |
RESERVATION_TYPE_ALL |
All reservations. |
Possible scope in which the reservation can be shared.
| Enums | |
|---|---|
SHARE_TYPE_UNSPECIFIED |
No share type specified. |
SHARE_TYPE_LOCAL |
Default value, for which reservation is open to only owner project. |
SHARE_TYPE_SPECIFIC_PROJECTS |
Shared-reservation is open to specific projects. |
OwnershipType
Reservation ownership status to provide distinction for Capacity Planning.
| Enums | |
|---|---|
OWNERSHIP_TYPE_UNSPECIFIED |
No ownership status specified. |
OWNERSHIP_TYPE_OWNED |
Reservations owned by the selected Google Cloud resource container (project, folder, or organization). |
OWNERSHIP_TYPE_SHARED_BY_OTHERS |
Reservations that the selected Google Cloud resource container (project, folder, or organization) can consume, but doesn't own. |
ReservationDataLevel
The form in which data of reservations should be returned. In case of AGGREGATED, timeseries for selected reservations is returned. If unspecified, all levels are included.
| Enums | |
|---|---|
RESERVATION_DATA_LEVEL_UNSPECIFIED |
No reservation data level specified. |
RESERVATION_DATA_LEVEL_AGGREGATED |
Aggregated reservations data as a time series, or as an aggregation over a time series. |
RESERVATION_DATA_LEVEL_PER_RESERVATION |
Per-reservation details for each future reservation or allocation, limited to the fields that are relevant for capacity planning. |
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 QueryReservations response.
QueryReservationsResponse
| JSON representation |
|---|
{
"reservations": [
{
object ( |
| Fields | |
|---|---|
reservations[] |
The reservations data that match the request. |
ReservationData
| JSON representation |
|---|
{ "name": string, "timeSeries": { object ( |
| Fields | |
|---|---|
name |
Identifier. The resource name of the reservation in the form of: |
timeSeries |
The collection of data points that represent the aggregated reserved value for reservations filtered by the criteria. |
usedReservationValues |
The collection of data points that represent the aggregated used value for reservations filtered by the criteria. |
futureReservations[] |
Future reservations filtered by the criteria. |
allocations[] |
Allocations filtered by the criteria. |
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. |
FutureReservation
| JSON representation |
|---|
{ "id": string, "createTime": string, "zone": string, "description": string, "futureReservation": string, "ownerProjectId": string, "timeWindow": { object ( |
| Fields | |
|---|---|
id |
A unique identifier for this future reservation. The server defines this identifier. |
createTime |
The creation timestamp for this future reservation. 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: |
zone |
URL of the Zone where this future reservation resides. |
description |
Description of the future reservation provided by user. |
futureReservation |
The future reservation resource name. |
ownerProjectId |
|
timeWindow |
Time window for this Future Reservation. |
shareSettings |
List of Projects/Folders to share with. |
namePrefix |
Name prefix for the reservations to be created at the time of delivery. The name prefix must comply with RFC1035. Maximum allowed length for name prefix is 20. Automatically created reservations name format will be |
status |
Status of the Future Reservation |
autoCreatedReservationsDeleteTime |
Future timestamp when the reservations that were automatically created by the future reservation will be deleted by Compute Engine. Format of this field must be a valid RFC3339 value. 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: |
autoDeleteAutoCreatedReservations |
Setting for enabling or disabling automatic deletion for auto-created reservation. If set to true, auto-created reservations will be deleted at Future Reservation's end time (default) or at user's defined timestamp if any of the [auto_created_reservations_delete_time, auto_created_reservations_duration] values is specified. For keeping auto-created reservation indefinitely, this value should be set to false. |
Union field type. The type of the future reservation which can only be for a specific SKU for now. type can be only one of the following: |
|
specificSkuProperties |
Future Reservation configuration to indicate instance properties and total count. |
SpecificSKUProperties
| JSON representation |
|---|
{
"instanceProperties": {
object ( |
| Fields | |
|---|---|
instanceProperties |
Properties of the SKU instances being reserved. |
totalCount |
Total number of instances for which capacity assurance is requested at a future time period. |
AllocatedInstanceProperties
| JSON representation |
|---|
{ "machineType": string, "guestAccelerator": [ { object ( |
| Fields | |
|---|---|
machineType |
Specifies type of machine (name only) which has fixed number of vCPUs and fixed amount of memory. This also includes specifying custom machine type following custom-NUMBER_OF_CPUS-AMOUNT_OF_MEMORY pattern. |
guestAccelerator[] |
Specifies accelerator type and count. |
minCpuPlatform |
Minimum CPU platform for the reservation. |
localSsd[] |
Specifies amount of local ssd to reserve with each instance. The type of disk is local-ssd. |
AcceleratorConfig
| JSON representation |
|---|
{ "type": string, "count": integer } |
| Fields | |
|---|---|
type |
Accelerator name. See https://cloud.google.com/compute/docs/gpus/#introduction for a full list of accelerator types. |
count |
The number of the guest accelerator cards exposed to this instance. |
AllocatedDisk
| JSON representation |
|---|
{
"diskSizeGb": string,
"diskInterface": enum ( |
| Fields | |
|---|---|
diskSizeGb |
Specifies the size of the disk in base-2 GB. |
diskInterface |
Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME. The default is SCSI. |
TimeWindow
| JSON representation |
|---|
{ "startTime": string, "endTime": string } |
| Fields | |
|---|---|
startTime |
Start time of the Future Reservation. 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: |
endTime |
End time of the Future Reservation. 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: |
| JSON representation |
|---|
{
"shareType": enum ( |
| Fields | |
|---|---|
shareType |
Type of sharing for this shared-reservation |
projects[] |
A List of Project names to specify consumer projects for this shared-reservation. This is only valid when share_type's value is SPECIFIC_PROJECTS. |
Status
| JSON representation |
|---|
{
"procurementStatus": enum ( |
| Fields | |
|---|---|
procurementStatus |
Current state of this Future Reservation |
lockTime |
Time when Future Reservation would become LOCKED, after which no modifications to Future Reservation will be allowed. Applicable only after the Future Reservation is in the APPROVED state. The lock_time is an RFC3339 string. The procurement_status will transition to PROCURING state at this time. 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: |
autoCreatedReservations[] |
Fully qualified urls of the automatically created reservations at start_time. |
fulfilledCount |
This count indicates the fulfilled capacity so far. This is set during "PROVISIONING" state. This count also includes capacity delivered as part of existing matching reservations. |
Allocation
| JSON representation |
|---|
{ "id": string, "createTime": string, "zone": string, "description": string, "allocation": string, "ownerProjectId": string, "status": enum ( |
| Fields | |
|---|---|
id |
The unique identifier for the resource. This identifier is defined by the server. |
createTime |
The creation timestamp for this allocation. 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: |
zone |
Zone in which the reservation resides. |
description |
A description while creating reservation. |
allocation |
The reservation resource name. |
ownerProjectId |
|
status |
The status of the reservation. |
shareSettings |
Specify share-settings to create a shared reservation. |
autoDeleteTime |
Absolute time in future when the reservation will be auto-deleted by Compute Engine. 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: |
Union field type. The type of the reservation which can only be for a specific SKU for now. type can be only one of the following: |
|
specificAllocation |
Reservation for instances with specific machine shapes. |
SpecificSKUAllocation
| JSON representation |
|---|
{
"instanceProperties": {
object ( |
| Fields | |
|---|---|
instanceProperties |
The instance properties for the reservation. |
count |
Specifies the number of resources that are allocated. |
usedCount |
Indicates how many instances are in use. |
assuredCount |
Indicates how many instances are actually usable currently. |
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. |
DiskInterface
guest device interface options to use for the disk.
| Enums | |
|---|---|
DISK_INTERFACE_UNSPECIFIED |
Default value. This value is unused. |
SCSI |
SCSI disk interface. |
NVME |
NVME disk interface. |
NVDIMM |
NVDIMM disk interface. |
ISCSI |
ISCSI disk interface. |
Possible scope in which the reservation can be shared.
| Enums | |
|---|---|
SHARE_TYPE_UNSPECIFIED |
Default value. This value is unused. |
ORGANIZATION |
Shared-reservation is open to entire Organization |
SPECIFIC_PROJECTS |
Shared-reservation is open to specific projects |
LOCAL |
Default value. |
DIRECT_PROJECTS_UNDER_SPECIFIC_FOLDERS |
Shared-reservation is open to direct child projects of specific folders. |
ProcurementStatus
Represents procurement status of the Future Reservation.
| Enums | |
|---|---|
PROCUREMENT_STATUS_UNSPECIFIED |
This is unused status value. |
PENDING_APPROVAL |
Future reservation is pending approval by Google Cloud. |
APPROVED |
Future reservation is approved by Google Cloud. |
COMMITTED |
Future reservation is committed by the customer. |
DECLINED |
Future reservation is rejected by Google Cloud. |
CANCELLED |
Future reservation is cancelled by the customer. |
PROCURING |
Future reservation is being procured by Google Cloud. Beyond this point, Future reservation is locked and no further modifications are allowed. |
PROVISIONING |
Future reservation capacity is being provisioned. This state will be entered after start_time, while reservations are being created to provide total_count reserved instance slots. This state will not persist past start_time + 24h. |
FULFILLED |
Future reservation is fulfilled completely. |
FAILED |
Future reservation failed. No additional reservations were provided. |
FAILED_PARTIALLY_FULFILLED |
Future reservation is partially fulfilled. Additional reservations were provided but did not reach total_count reserved instance slots. |
DRAFTING |
Future reservation is a draft that hasn't been submitted yet. Transitions to PENDING_APPROVAL when the user submits the future reservation. |
PENDING_AMENDMENT_APPROVAL |
An Amendment to the Future Reservation has been requested. If the Amendment is declined, the Future Reservation will be restored to the last known good state. |
Status
The status of the reservation.
| Enums | |
|---|---|
STATUS_UNSPECIFIED |
Default value. This value is unused. |
INVALID |
Invalid Reservation |
CREATING |
Resources are being allocated for the reservation. |
READY |
Reservation has allocated all its resources. |
DELETING |
Reservation is currently being deleted. |
UPDATING |
Reservation is currently being resized. |
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: ❌