Tool: list_users
List all database users for a Cloud SQL instance.
The following code sample shows how to use curl to call the list_users MCP tool.
| Curl Request |
|---|
curl --location 'https://sqladmin.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "list_users", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
SqlUsersListRequest
| JSON representation |
|---|
{ "instance": string, "project": string, "location": string } |
| Fields | |
|---|---|
instance |
Database instance ID. This does not include the project ID. |
project |
Project ID of the project that contains the instance. |
location |
Optional. Region of the Cloud SQL instance. |
Output Schema
User list response.
UsersListResponse
| JSON representation |
|---|
{
"kind": string,
"items": [
{
object ( |
| Fields | |
|---|---|
kind |
This is always |
items[] |
List of user resources in the instance. |
nextPageToken |
Unused. |
User
| JSON representation |
|---|
{ "kind": string, "password": string, "etag": string, "name": string, "host": string, "instance": string, "project": string, "type": enum ( |
| Fields | |
|---|---|
kind |
This is always |
password |
The password for the user. |
etag |
This field is deprecated and will be removed from a future version of the API. |
name |
The name of the user in the Cloud SQL instance. Can be omitted for |
host |
Optional. The host from which the user can connect. For |
instance |
The name of the Cloud SQL instance. This does not include the project ID. Can be omitted for |
project |
The project ID of the project containing the Cloud SQL database. The Google apps domain is prefixed if applicable. Can be omitted for |
type |
The user type. It determines the method to authenticate the user during login. The default is the database's built-in user type. |
iamEmail |
Optional. The full email for an IAM user. For normal database users, this will not be filled. Only applicable to MySQL database users. |
passwordPolicy |
User level password validation policy. |
databaseRoles[] |
Optional. Role memberships of the user |
serverRoles[] |
Optional. The server roles for the SQL Server login. |
Union field user_details. User details for specific database type user_details can be only one of the following: |
|
sqlserverUserDetails |
|
Union field
|
|
dualPasswordType |
Dual password status for the user. |
Union field
|
|
iamStatus |
Indicates if a group is active or inactive for IAM database authentication. |
SqlServerUserDetails
| JSON representation |
|---|
{ "disabled": boolean, "serverRoles": [ string ] } |
| Fields | |
|---|---|
disabled |
Indicates if the user has been disabled. |
serverRoles[] |
Indicates the server roles for this user. |
UserPasswordValidationPolicy
| JSON representation |
|---|
{
"allowedFailedAttempts": integer,
"passwordExpirationDuration": string,
"enableFailedAttemptsCheck": boolean,
"status": {
object ( |
| Fields | |
|---|---|
allowedFailedAttempts |
Number of failed login attempts allowed before user get locked. |
passwordExpirationDuration |
Expiration duration after password is updated. A duration in seconds with up to nine fractional digits, ending with ' |
enableFailedAttemptsCheck |
If true, failed login attempts check will be enabled. |
status |
Output only. Read-only password status. |
enablePasswordVerification |
If true, the user must specify the current password before changing the password. This flag is supported only for MySQL. |
Duration
| JSON representation |
|---|
{ "seconds": string, "nanos": integer } |
| Fields | |
|---|---|
seconds |
Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years |
nanos |
Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 |
PasswordStatus
| JSON representation |
|---|
{ "locked": boolean, "passwordExpirationTime": string } |
| Fields | |
|---|---|
locked |
If true, user does not have login privileges. |
passwordExpirationTime |
The expiration time of the current password. 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: |
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. |
SqlUserType
The user type.
| Enums | |
|---|---|
BUILT_IN |
The database's built-in user type. |
CLOUD_IAM_USER |
Cloud IAM user. |
CLOUD_IAM_SERVICE_ACCOUNT |
Cloud IAM service account. |
CLOUD_IAM_GROUP |
Cloud IAM group. Not used for login. |
CLOUD_IAM_GROUP_USER |
Read-only. Login for a user that belongs to the Cloud IAM group. |
CLOUD_IAM_GROUP_SERVICE_ACCOUNT |
Read-only. Login for a service account that belongs to the Cloud IAM group. |
CLOUD_IAM_WORKFORCE_IDENTITY |
Cloud IAM workforce identity managed by Workforce Identity Federation. |
ENTRAID_USER |
Microsoft Entra ID user. |
DualPasswordType
The type of retained password.
| Enums | |
|---|---|
DUAL_PASSWORD_TYPE_UNSPECIFIED |
The default value. |
NO_MODIFY_DUAL_PASSWORD |
Do not update the user's dual password status. |
NO_DUAL_PASSWORD |
No dual password usable for connecting using this user. |
DUAL_PASSWORD |
Dual password usable for connecting using this user. |
IamStatus
Indicates if a group is available for IAM database authentication.
| Enums | |
|---|---|
IAM_STATUS_UNSPECIFIED |
The default value for users that are not of type CLOUD_IAM_GROUP. Only CLOUD_IAM_GROUP users will be inactive or active. Users with an IamStatus of IAM_STATUS_UNSPECIFIED will not display whether they are active or inactive as that is not applicable to them. |
INACTIVE |
INACTIVE indicates a group is not available for IAM database authentication. |
ACTIVE |
ACTIVE indicates a group is available for IAM database authentication. |
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: ❌