Tool: list_databases
List Spanner databases in a given spanner instance. * Response may include next_page_token to fetch additional databases using list_databases tool with page_token set.
The following sample demonstrate how to use curl to invoke the list_databases 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_databases", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The request for ListDatabases.
ListDatabasesRequest
| JSON representation |
|---|
{ "parent": string, "pageSize": integer, "pageToken": string } |
| Fields | |
|---|---|
parent |
Required. The instance whose databases should be listed. Values are of the form |
pageSize |
Number of databases to be returned in the response. If 0 or less, defaults to the server's maximum allowed page size. |
pageToken |
If non-empty, |
Output Schema
The response for ListDatabases.
ListDatabasesResponse
| JSON representation |
|---|
{
"databases": [
{
object ( |
| Fields | |
|---|---|
databases[] |
Databases that matched the request. |
nextPageToken |
|
Database
| JSON representation |
|---|
{ "name": string, "state": enum ( |
| Fields | |
|---|---|
name |
Required. The name of the database. Values are of the form |
state |
Output only. The current database state. |
createTime |
Output only. If exists, the time at which the database creation started. 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: |
restoreInfo |
Output only. Applicable only for restored databases. Contains information about the restore source. |
encryptionConfig |
Output only. For databases that are using customer managed encryption, this field contains the encryption configuration for the database. For databases that are using Google default or other types of encryption, this field is empty. |
encryptionInfo[] |
Output only. For databases that are using customer managed encryption, this field contains the encryption information for the database, such as all Cloud KMS key versions that are in use. The For databases that are using Google default or other types of encryption, this field is empty. This field is propagated lazily from the backend. There might be a delay from when a key version is being used and when it appears in this field. |
versionRetentionPeriod |
Output only. The period in which Cloud Spanner retains all versions of data for the database. This is the same as the value of version_retention_period database option set using |
earliestVersionTime |
Output only. Earliest timestamp at which older versions of the data can be read. This value is continuously updated by Cloud Spanner and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery. 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: |
defaultLeader |
Output only. The read-write region which contains the database's leader replicas. This is the same as the value of default_leader database option set using DatabaseAdmin.CreateDatabase or DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty. |
databaseDialect |
Output only. The dialect of the Cloud Spanner Database. |
enableDropProtection |
Optional. Whether drop protection is enabled for this database. Defaults to false, if not set. For more details, please see how to prevent accidental database deletion. |
reconciling |
Output only. If true, the database is being updated. If false, there are no ongoing update operations for the database. |
quorumInfo |
Output only. Applicable only for databases that use dual-region instance configurations. Contains information about the quorum. |
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. |
RestoreInfo
| JSON representation |
|---|
{ "sourceType": enum ( |
| Fields | |
|---|---|
sourceType |
The type of the restore source. |
Union field source_info. Information about the source used to restore the database. source_info can be only one of the following: |
|
backupInfo |
Information about the backup used to restore the database. The backup may no longer exist. |
BackupInfo
| JSON representation |
|---|
{ "backup": string, "versionTime": string, "createTime": string, "sourceDatabase": string } |
| Fields | |
|---|---|
backup |
Name of the backup. |
versionTime |
The backup contains an externally consistent copy of 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: |
createTime |
The time the 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: |
sourceDatabase |
Name of the database the backup was created from. |
EncryptionConfig
| JSON representation |
|---|
{ "kmsKeyName": string, "kmsKeyNames": [ string ] } |
| Fields | |
|---|---|
kmsKeyName |
The Cloud KMS key to be used for encrypting and decrypting the database. Values are of the form |
kmsKeyNames[] |
Specifies the KMS configuration for one or more keys used to encrypt the database. Values are of the form The keys referenced by
|
EncryptionInfo
| JSON representation |
|---|
{ "encryptionType": enum ( |
| Fields | |
|---|---|
encryptionType |
Output only. The type of encryption. |
encryptionStatus |
Output only. If present, the status of a recent encrypt/decrypt call on underlying data for this database or backup. Regardless of status, data is always encrypted at rest. |
kmsKeyVersion |
Output only. A Cloud KMS key version that is being used to protect the database or backup. |
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 |
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. |
QuorumInfo
| JSON representation |
|---|
{ "quorumType": { object ( |
| Fields | |
|---|---|
quorumType |
Output only. The type of this quorum. See |
initiator |
Output only. Whether this |
startTime |
Output only. The timestamp when the request was triggered. 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: |
etag |
Output only. The etag is used for optimistic concurrency control as a way to help prevent simultaneous |
QuorumType
| JSON representation |
|---|
{ // Union field |
| Fields | |
|---|---|
Union field type. The type of quorum. type can be only one of the following: |
|
singleRegion |
Single-region quorum type. |
dualRegion |
Dual-region quorum type. |
SingleRegionQuorum
| JSON representation |
|---|
{ "servingLocation": string } |
| Fields | |
|---|---|
servingLocation |
Required. The location of the serving region, for example, "us-central1". The location must be one of the regions within the dual-region instance configuration of your database. The list of valid locations is available using the [GetInstanceConfig][InstanceAdmin.GetInstanceConfig] API. This should only be used if you plan to change quorum to the single-region quorum type. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ✅ | Open World Hint: ❌