Tool: create_instance
Create a Spanner instance in a given project.
The following sample demonstrate how to use curl to invoke the create_instance 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": "create_instance", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The request for CreateInstance.
CreateInstanceRequest
| JSON representation |
|---|
{
"parent": string,
"instanceId": string,
"instance": {
object ( |
| Fields | |
|---|---|
parent |
Required. The name of the project in which to create the instance. Values are of the form |
instanceId |
Required. The ID of the instance to create. Valid identifiers are of the form |
instance |
Required. The instance to create. The name may be omitted, but if specified must be |
Instance
| JSON representation |
|---|
{ "name": string, "config": string, "displayName": string, "nodeCount": integer, "processingUnits": integer, "replicaComputeCapacity": [ { object ( |
| Fields | |
|---|---|
name |
Required. A unique identifier for the instance, which cannot be changed after the instance is created. Values are of the form |
config |
Required. The name of the instance's configuration. Values are of the form |
displayName |
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 |
The number of nodes allocated to this instance. At most, one of either Users can set the If autoscaling is enabled, This might be zero in API responses for instances that are not yet in the If the instance has varying node count across replicas (achieved by setting For more information, see Compute capacity, nodes, and processing units. |
processingUnits |
The number of processing units allocated to this instance. At most, one of either Users can set the If autoscaling is enabled, This might be zero in API responses for instances that are not yet in the If the instance has varying processing units per replica (achieved by setting For more information, see Compute capacity, nodes and processing units. |
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 |
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 |
Output only. The current instance state. For |
labels |
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.).
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 |
instanceType |
The |
endpointUris[] |
Deprecated. This field is not populated. |
createTime |
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: |
updateTime |
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: |
freeInstanceMetadata |
Free instance metadata. Only populated for free instances. |
edition |
Optional. The |
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 In the |
ReplicaComputeCapacity
| JSON representation |
|---|
{ "replicaSelection": { object ( |
| Fields | |
|---|---|
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 |
The number of nodes allocated to each replica. This may be zero in API responses for instances that are not yet in state |
processingUnits |
The number of processing units allocated to each replica. This may be zero in API responses for instances that are not yet in state |
ReplicaSelection
| JSON representation |
|---|
{ "location": string } |
| Fields | |
|---|---|
location |
Required. Name of the location of the replicas (for example, "us-central1"). |
AutoscalingConfig
| JSON representation |
|---|
{ "autoscalingLimits": { object ( |
| Fields | |
|---|---|
autoscalingLimits |
Required. Autoscaling limits for an instance. |
autoscalingTargets |
Required. The autoscaling targets for an instance. |
asymmetricAutoscalingOptions[] |
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 |
| Fields | |
|---|---|
Union field min_limit. The minimum compute capacity for the instance. min_limit can be only one of the following: |
|
minNodes |
Minimum number of nodes allocated to the instance. If set, this number should be greater than or equal to 1. |
minProcessingUnits |
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 |
Maximum number of nodes allocated to the instance. If set, this number should be greater than or equal to min_nodes. |
maxProcessingUnits |
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 |
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 |
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 |
storageUtilizationPercent |
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 ( |
| Fields | |
|---|---|
replicaSelection |
Required. Selects the replicas to which this AsymmetricAutoscalingOption applies. Only read-only replicas are supported. |
overrides |
Optional. Overrides applied to the top-level autoscaling configuration for the selected replicas. |
AutoscalingConfigOverrides
| JSON representation |
|---|
{
"autoscalingLimits": {
object ( |
| Fields | |
|---|---|
autoscalingLimits |
Optional. If specified, overrides the min/max limit in the top-level autoscaling configuration for the selected replicas. |
autoscalingTargetHighPriorityCpuUtilizationPercent |
Optional. If specified, overrides the autoscaling target high_priority_cpu_utilization_percent in the top-level autoscaling configuration for the selected replicas. |
autoscalingTargetTotalCpuUtilizationPercent |
Optional. If specified, overrides the autoscaling target |
disableHighPriorityCpuAutoscaling |
Optional. If true, disables high priority CPU autoscaling for the selected replicas and ignores When setting this field to true, setting If false, the Setting both |
disableTotalCpuAutoscaling |
Optional. If true, disables total CPU autoscaling for the selected replicas and ignores When setting this field to true, setting If false, the Setting both |
LabelsEntry
| JSON representation |
|---|
{ "key": string, "value": string } |
| Fields | |
|---|---|
key |
|
value |
|
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. |
FreeInstanceMetadata
| JSON representation |
|---|
{
"expireTime": string,
"upgradeTime": string,
"expireBehavior": enum ( |
| Fields | |
|---|---|
expireTime |
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: |
upgradeTime |
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: |
expireBehavior |
Specifies the expiration behavior of a free instance. The default of ExpireBehavior is |
Output Schema
This resource represents a long-running operation that is the result of a network API call.
Operation
| JSON representation |
|---|
{ "name": string, "metadata": { "@type": string, field1: ..., ... }, "done": boolean, // Union field |
| Fields | |
|---|---|
name |
The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the |
metadata |
Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. An object containing fields of an arbitrary type. An additional field |
done |
If the value is |
Union field result. The operation result, which can be either an error or a valid response. If done == false, neither error nor response is set. If done == true, exactly one of error or response can be set. Some services might not provide the result. result can be only one of the following: |
|
error |
The error result of the operation in case of failure or cancellation. |
response |
The normal, successful response of the operation. If the original method returns no data on success, such as An object containing fields of an arbitrary type. An additional field |
Any
| JSON representation |
|---|
{ "typeUrl": string, "value": string } |
| Fields | |
|---|---|
typeUrl |
A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one "/" character. The last segment of the URL's path must represent the fully qualified name of the type (as in In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme
Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. As of May 2023, there are no widely used type server implementations and no plans to implement one. Schemes other than |
value |
Must be a valid serialized protocol buffer of the above specified type. A base64-encoded string. |
Status
| JSON representation |
|---|
{ "code": integer, "message": string, "details": [ { "@type": string, field1: ..., ... } ] } |
| Fields | |
|---|---|
code |
The status code, which should be an enum value of |
message |
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the |
details[] |
A list of messages that carry the error details. There is a common set of message types for APIs to use. An object containing fields of an arbitrary type. An additional field |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ❌