MCP Tools Reference: spanner.googleapis.com

Tool: list_instances

List Spanner instances in a given project. * Response may include next_page_token to fetch additional instances using list_instances tool with page_token set.

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

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

Input Schema

The request for ListInstances.

ListInstancesRequest

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

string

Required. The name of the project for which a list of instances is requested. Values are of the form projects/<project>.

pageSize

integer

Number of instances to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size.

pageToken

string

If non-empty, page_token should contain a next_page_token from a previous ListInstancesResponse.

filter

string

An expression for filtering the results of the request. Filter rules are case insensitive. The fields eligible for filtering are:

  • name
  • display_name
  • labels.key where key is the name of a label

Some examples of using filters are:

  • name:* --> The instance has a name.
  • name:Howl --> The instance's name contains the string "howl".
  • name:HOWL --> Equivalent to above.
  • NAME:howl --> Equivalent to above.
  • labels.env:* --> The instance has the label "env".
  • labels.env:dev --> The instance has the label "env" and the value of the label contains the string "dev".
  • name:howl labels.env:dev --> The instance's name contains "howl" and it has the label "env" with its value containing "dev".
instanceDeadline

string (Timestamp format)

Deadline used while retrieving metadata for instances. Instances whose metadata cannot be retrieved within this deadline will be added to unreachable in ListInstancesResponse.

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".

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.

Output Schema

The response for ListInstances.

ListInstancesResponse

JSON representation
{
  "instances": [
    {
      object (Instance)
    }
  ],
  "nextPageToken": string,
  "unreachable": [
    string
  ]
}
Fields
instances[]

object (Instance)

The list of requested instances.

nextPageToken

string

next_page_token can be sent in a subsequent ListInstances call to fetch more of the matching instances.

unreachable[]

string

The list of unreachable instances. It includes the names of instances whose metadata could not be retrieved within instance_deadline.

Instance

JSON representation
{
  "name": string,
  "config": string,
  "displayName": string,
  "nodeCount": integer,
  "processingUnits": integer,
  "replicaComputeCapacity": [
    {
      object (ReplicaComputeCapacity)
    }
  ],
  "autoscalingConfig": {
    object (AutoscalingConfig)
  },
  "state": enum (State),
  "labels": {
    string: string,
    ...
  },
  "instanceType": enum (InstanceType),
  "endpointUris": [
    string
  ],
  "createTime": string,
  "updateTime": string,
  "freeInstanceMetadata": {
    object (FreeInstanceMetadata)
  },
  "edition": enum (Edition),
  "defaultBackupScheduleType": enum (DefaultBackupScheduleType)
}
Fields
name

string

Required. A unique identifier for the instance, which cannot be changed after the instance is created. Values are of the form projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]. The final segment of the name must be between 2 and 64 characters in length.

config

string

Required. The name of the instance's configuration. Values are of the form projects/<project>/instanceConfigs/<configuration>. See also InstanceConfig and ListInstanceConfigs.

displayName

string

Required. The descriptive name for this instance as it appears in UIs. Must be unique per project and between 4 and 30 characters in length.

nodeCount

integer

The number of nodes allocated to this instance. At most, one of either node_count or processing_units should be present in the message.

Users can set the node_count field to specify the target number of nodes allocated to the instance.

If autoscaling is enabled, node_count is treated as an OUTPUT_ONLY field and reflects the current number of nodes allocated to the instance.

This might be zero in API responses for instances that are not yet in the READY state.

If the instance has varying node count across replicas (achieved by setting asymmetric_autoscaling_options in the autoscaling configuration), the node_count set here is the maximum node count across all replicas.

For more information, see Compute capacity, nodes, and processing units.

processingUnits

integer

The number of processing units allocated to this instance. At most, one of either processing_units or node_count should be present in the message.

Users can set the processing_units field to specify the target number of processing units allocated to the instance.

If autoscaling is enabled, processing_units is treated as an OUTPUT_ONLY field and reflects the current number of processing units allocated to the instance.

This might be zero in API responses for instances that are not yet in the READY state.

If the instance has varying processing units per replica (achieved by setting asymmetric_autoscaling_options in the autoscaling configuration), the processing_units set here is the maximum processing units across all replicas.

For more information, see Compute capacity, nodes and processing units.

replicaComputeCapacity[]

object (ReplicaComputeCapacity)

Output only. Lists the compute capacity per ReplicaSelection. A replica selection identifies a set of replicas with common properties. Replicas identified by a ReplicaSelection are scaled with the same compute capacity.

autoscalingConfig

object (AutoscalingConfig)

Optional. The autoscaling configuration. Autoscaling is enabled if this field is set. When autoscaling is enabled, node_count and processing_units are treated as OUTPUT_ONLY fields and reflect the current compute capacity allocated to the instance.

state

enum (State)

Output only. The current instance state. For CreateInstance, the state must be either omitted or set to CREATING. For UpdateInstance, the state must be either omitted or set to READY.

labels

map (key: string, value: string)

Cloud Labels are a flexible and lightweight mechanism for organizing cloud resources into groups that reflect a customer's organizational needs and deployment strategies. Cloud Labels can be used to filter collections of resources. They can be used to control how resource metrics are aggregated. And they can be used as arguments to policy management rules (e.g. route, firewall, load balancing, etc.).

  • Label keys must be between 1 and 63 characters long and must conform to the following regular expression: [a-z][a-z0-9_-]{0,62}.
  • Label values must be between 0 and 63 characters long and must conform to the regular expression [a-z0-9_-]{0,63}.
  • No more than 64 labels can be associated with a given resource.

See https://goo.gl/xmQnxf for more information on and examples of labels.

If you plan to use labels in your own code, please note that additional characters may be allowed in the future. And so you are advised to use an internal label representation, such as JSON, which doesn't rely upon specific characters being disallowed. For example, representing labels as the string: name + "_" + value would prove problematic if we were to allow "_" in a future release.

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

instanceType

enum (InstanceType)

The InstanceType of the current instance.

endpointUris[]

string

Deprecated. This field is not populated.

createTime

string (Timestamp format)

Output only. The time at which the instance was created.

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".

updateTime

string (Timestamp format)

Output only. The time at which the instance was most recently updated.

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".

freeInstanceMetadata

object (FreeInstanceMetadata)

Free instance metadata. Only populated for free instances.

edition

enum (Edition)

Optional. The Edition of the current instance.

defaultBackupScheduleType

enum (DefaultBackupScheduleType)

Optional. Controls the default backup schedule behavior for new databases within the instance. By default, a backup schedule is created automatically when a new database is created in a new instance.

Note that the AUTOMATIC value isn't permitted for free instances, as backups and backup schedules aren't supported for free instances.

In the GetInstance or ListInstances response, if the value of default_backup_schedule_type isn't set, or set to NONE, Spanner doesn't create a default backup schedule for new databases in the instance.

ReplicaComputeCapacity

JSON representation
{
  "replicaSelection": {
    object (ReplicaSelection)
  },

  // Union field compute_capacity can be only one of the following:
  "nodeCount": integer,
  "processingUnits": integer
  // End of list of possible types for union field compute_capacity.
}
Fields
replicaSelection

object (ReplicaSelection)

Required. Identifies replicas by specified properties. All replicas in the selection have the same amount of compute capacity.

Union field compute_capacity. Compute capacity allocated to each replica identified by the specified selection. The unit is selected based on the unit used to specify the instance size for non-autoscaling instances, or the unit used in autoscaling limit for autoscaling instances. compute_capacity can be only one of the following:
nodeCount

integer

The number of nodes allocated to each replica.

This may be zero in API responses for instances that are not yet in state READY.

processingUnits

integer

The number of processing units allocated to each replica.

This may be zero in API responses for instances that are not yet in state READY.

ReplicaSelection

JSON representation
{
  "location": string
}
Fields
location

string

Required. Name of the location of the replicas (for example, "us-central1").

AutoscalingConfig

JSON representation
{
  "autoscalingLimits": {
    object (AutoscalingLimits)
  },
  "autoscalingTargets": {
    object (AutoscalingTargets)
  },
  "asymmetricAutoscalingOptions": [
    {
      object (AsymmetricAutoscalingOption)
    }
  ]
}
Fields
autoscalingLimits

object (AutoscalingLimits)

Required. Autoscaling limits for an instance.

autoscalingTargets

object (AutoscalingTargets)

Required. The autoscaling targets for an instance.

asymmetricAutoscalingOptions[]

object (AsymmetricAutoscalingOption)

Optional. Optional asymmetric autoscaling options. Replicas matching the replica selection criteria will be autoscaled independently from other replicas. The autoscaler will scale the replicas based on the utilization of replicas identified by the replica selection. Replica selections should not overlap with each other.

Other replicas (those do not match any replica selection) will be autoscaled together and will have the same compute capacity allocated to them.

AutoscalingLimits

JSON representation
{

  // Union field min_limit can be only one of the following:
  "minNodes": integer,
  "minProcessingUnits": integer
  // End of list of possible types for union field min_limit.

  // Union field max_limit can be only one of the following:
  "maxNodes": integer,
  "maxProcessingUnits": integer
  // End of list of possible types for union field max_limit.
}
Fields
Union field min_limit. The minimum compute capacity for the instance. min_limit can be only one of the following:
minNodes

integer

Minimum number of nodes allocated to the instance. If set, this number should be greater than or equal to 1.

minProcessingUnits

integer

Minimum number of processing units allocated to the instance. If set, this number should be multiples of 1000.

Union field max_limit. The maximum compute capacity for the instance. The maximum compute capacity should be less than or equal to 10X the minimum compute capacity. max_limit can be only one of the following:
maxNodes

integer

Maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes.

maxProcessingUnits

integer

Maximum number of processing units allocated to the instance. If set, this number should be multiples of 1000 and be greater than or equal to min_processing_units.

AutoscalingTargets

JSON representation
{
  "highPriorityCpuUtilizationPercent": integer,
  "totalCpuUtilizationPercent": integer,
  "storageUtilizationPercent": integer
}
Fields
highPriorityCpuUtilizationPercent

integer

Optional. The target high priority cpu utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization). The valid range is [10, 90] inclusive. If not specified or set to 0, the autoscaler skips scaling based on high priority CPU utilization.

totalCpuUtilizationPercent

integer

Optional. The target total CPU utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization). The valid range is [10, 90] inclusive. If not specified or set to 0, the autoscaler skips scaling based on total CPU utilization. If both high_priority_cpu_utilization_percent and total_cpu_utilization_percent are specified, the autoscaler provisions the larger of the two required compute capacities to satisfy both targets.

storageUtilizationPercent

integer

Required. The target storage utilization percentage that the autoscaler should be trying to achieve for the instance. This number is on a scale from 0 (no utilization) to 100 (full utilization). The valid range is [10, 99] inclusive.

AsymmetricAutoscalingOption

JSON representation
{
  "replicaSelection": {
    object (ReplicaSelection)
  },
  "overrides": {
    object (AutoscalingConfigOverrides)
  }
}
Fields
replicaSelection

object (ReplicaSelection)

Required. Selects the replicas to which this AsymmetricAutoscalingOption applies. Only read-only replicas are supported.

overrides

object (AutoscalingConfigOverrides)

Optional. Overrides applied to the top-level autoscaling configuration for the selected replicas.

AutoscalingConfigOverrides

JSON representation
{
  "autoscalingLimits": {
    object (AutoscalingLimits)
  },
  "autoscalingTargetHighPriorityCpuUtilizationPercent": integer,
  "autoscalingTargetTotalCpuUtilizationPercent": integer,
  "disableHighPriorityCpuAutoscaling": boolean,
  "disableTotalCpuAutoscaling": boolean
}
Fields
autoscalingLimits

object (AutoscalingLimits)

Optional. If specified, overrides the min/max limit in the top-level autoscaling configuration for the selected replicas.

autoscalingTargetHighPriorityCpuUtilizationPercent

integer

Optional. If specified, overrides the autoscaling target high_priority_cpu_utilization_percent in the top-level autoscaling configuration for the selected replicas.

autoscalingTargetTotalCpuUtilizationPercent

integer

Optional. If specified, overrides the autoscaling target total_cpu_utilization_percent in the top-level autoscaling configuration for the selected replicas.

disableHighPriorityCpuAutoscaling

boolean

Optional. If true, disables high priority CPU autoscaling for the selected replicas and ignores high_priority_cpu_utilization_percent in the top-level autoscaling configuration.

When setting this field to true, setting autoscaling_target_high_priority_cpu_utilization_percent field to a non-zero value for the same replica is not supported.

If false, the autoscaling_target_high_priority_cpu_utilization_percent field in the replica will be used if set to a non-zero value. Otherwise, the high_priority_cpu_utilization_percent field in the top-level autoscaling configuration will be used.

Setting both disable_high_priority_cpu_autoscaling and disable_total_cpu_autoscaling to true for the same replica is not supported.

disableTotalCpuAutoscaling

boolean

Optional. If true, disables total CPU autoscaling for the selected replicas and ignores total_cpu_utilization_percent in the top-level autoscaling configuration.

When setting this field to true, setting autoscaling_target_total_cpu_utilization_percent field to a non-zero value for the same replica is not supported.

If false, the autoscaling_target_total_cpu_utilization_percent field in the replica will be used if set to a non-zero value. Otherwise, the total_cpu_utilization_percent field in the top-level autoscaling configuration will be used.

Setting both disable_high_priority_cpu_autoscaling and disable_total_cpu_autoscaling to true for the same replica is not supported.

LabelsEntry

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

string

value

string

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.

FreeInstanceMetadata

JSON representation
{
  "expireTime": string,
  "upgradeTime": string,
  "expireBehavior": enum (ExpireBehavior)
}
Fields
expireTime

string (Timestamp format)

Output only. Timestamp after which the instance will either be upgraded or scheduled for deletion after a grace period. ExpireBehavior is used to choose between upgrading or scheduling the free instance for deletion. This timestamp is set during the creation of a free instance.

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".

upgradeTime

string (Timestamp format)

Output only. If present, the timestamp at which the free instance was upgraded to a provisioned instance.

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".

expireBehavior

enum (ExpireBehavior)

Specifies the expiration behavior of a free instance. The default of ExpireBehavior is REMOVE_AFTER_GRACE_PERIOD. This can be modified during or after creation, and before expiration.

Tool Annotations

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