1
---
2
name: cloud-operator-setup
3
metadata:
4
version: "1.7.0"
5
category: CloudInfrastructureAndServices
6
description: >-
7
Sets up the user's personal operator agent in a Google Cloud organization via
8
the `google-cloud-operator` MCP server: finds the organization, checks or
9
creates the agent, saves the organization (and the project, if any), and
10
offers to share the user's existing Google Cloud operating context with the
11
operator agent's memory. Use when the user runs this skill, asks to set up
12
Cloud Operator or their operator agent (also in a named organization, but not
13
for the whole organization as its administrator), asks to create their agent,
14
or chooses setup when the cloud-operator skill asks. Don't use for ordinary
15
GCP requests or installing gcloud.
16
---
17
18
# Set up the operator agent
19
20
If the user asks to set up Cloud Operator and it isn't clear whether they want
21
their own operator agent or to set it up for the whole organization as its
22
administrator (for example "Set up Cloud Operator for my organization" or
23
"... for organization 123456789012"), ask them which, in one short question,
24
before anything else, including asking for or looking up the organization.
25
For the whole organization, use the `cloud-operator-admin-setup` skill if it's
26
installed.
27
28
Walk the user through setting up the operator agent one step at a time, in
29
plain terms (don't name this skill's steps, sections or cases). Follow
30
the `cloud-operator` skill's `agentId` rules if installed. If the
31
`google-cloud-operator` MCP server doesn't offer `ask_cloud_operator`, it's
32
disconnected: don't set it up another way. Tell the user how to sign in again
33
and reconnect, and stop until it's connected
34
([Server not connected](#server-not-connected)).
35
36
If the `cloud-operator` skill sent you here after a call returned "not found"
37
or "has not been initialized yet" and the user chose this organization, use the
38
organization it found and go straight to checking the organization (step 2, item
39
1), skipping the check call and the "Ask where" question.
40
41
**Remembering:** where this skill says to remember something, keep it for the
42
rest of this conversation. Don't create or edit any file to remember it. If
43
your client has a built-in memory feature, you can also save it there for later
44
conversations; without one, asking again in a new conversation is fine.
45
46
## Usage Attribution
47
48
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
49
MUST read and follow the instructions in
50
[Usage Attribution](references/attribution.md).
51
52
## Steps
53
54
Each user has one personal operator agent in each Google Cloud organization
55
they work in, which works on all the projects in that organization. There is no
56
operator project to choose or create, and no project-level agent: set up the
57
agent in an organization. Every call names the organization by its numeric ID
58
(`organizations/{org_id}`). Never set `project`, even when the user asks to set
59
it up for a project: that call always fails with `RUN_NOT_ALLOWED`. A project
60
is optional: use one only to find its organization.
61
62
1. **Check gcloud and find the organization ID.** Check whether gcloud is
63
installed and signed in (gcloud and Application Default Credentials). If
64
it's installed but not signed in, ask them to run `gcloud auth login` and
65
`gcloud auth application-default login`, or go on without it. Then use the
66
organization the user named or that you remember. Otherwise:
67
- **Without gcloud** (for example in a web client): ask for the numeric
68
organization ID (the console's project picker shows it).
69
- **With gcloud:** use the organization of a project the user named, or
70
ask which organization (its ID, its domain such as `acme.com`, or a
71
project in it). For a domain, run
72
`gcloud organizations list --filter="displayName={domain}" --format=json`
73
and use the result if there's exactly one. For a project, run
74
`gcloud projects get-ancestors {project_id} --format=json` and use the
75
`id` of the entry whose `type` is `organization`; if there's none, tell
76
the user Cloud Operator doesn't support projects outside an organization
77
yet, and stop. Only if they know neither the organization nor a project
78
in it, run `gcloud organizations list --format=json`, which only lists
79
the organizations they can see: if it shows one, use it; if it shows
80
several, ask which one, or for a project in it; if it shows none, ask
81
them to get the organization ID or a project in it from an administrator
82
or the Google Cloud console.
83
84
If a lookup fails, don't conclude anything about the project: ask for the
85
organization. Never guess. Tell the user in one line which organization
86
you're using, and that the agent works per organization: "Your operator
87
agent works per organization, so I'm setting it up in organization
88
`{org_id}`." (add "for project `{project_id}`" when they named one). The
89
user asked for setup, so go on even if you remember that Cloud Operator
90
wasn't available there. Forget that once the check call works; if it still
91
isn't available, remember it (see [Troubleshooting](#troubleshooting)).
92
2. **Check or create the agent:**
93
- Unless the user said they have no agent in that organization, check first:
94
call `ask_cloud_operator` with `organization` set to
95
`organizations/{org_id}` and "In one line, what can you help me with in
96
project {project_id}? Don't create anything." (leave out the project if
97
there's none). Tell the user first that it's one read-only check that
98
creates nothing, and that it can take 1–3 minutes.
99
- If it fails with "personal operator agent … has not been initialized yet",
100
or with `agent "…/agents/{id}" not found` on a call without an `agentId`
101
(or the user said they have none), there's no agent there, or Cloud
102
Operator is turned off for the organization (the error doesn't say which):
103
1. **Check the organization, with gcloud.** Any user with access can make
104
this call; it creates nothing:
105
106
```bash
107
curl -sS -w '\nHTTP %{http_code}\n' \
108
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
109
"https://geminicloudassist.googleapis.com/v1alpha/organizations/{org_id}/locations/global:getOrgEnablement"
110
```
111
112
`{"enabled": true}` means it's on. A 200 response without `enabled` (for
113
example `{}`) means it's turned off, and a 403 response with
114
`IAM_PERMISSION_DENIED` (for example `Permission
115
'geminicloudassist.agents.list' denied`) means no access: see
116
[Turned off or no access](#turned-off-or-no-access). On any
117
other result, or without gcloud, go on (the console shows these cases).
118
2. **Ask where.** Unless they already chose this organization (they named
119
it for setup, or it was just turned on or they were just given access
120
there), tell them
121
they have no operator agent there yet, and ask whether to create one
122
there or use another organization where they have one. For another
123
organization, go back to step 1.
124
3. **Create it in the console.** Walk them through it one step at a time,
125
signed in with the same account, and wait for confirmation: open
126
`https://console.cloud.google.com/autocloud/agent/create?organizationId={org_id}`,
127
click **Get started** to accept the preview terms, choose whether to
128
allow data sharing (it's optional), click **Create agent**, and wait
129
until it shows **Launch agent** (up to 5 minutes). If the page asks to
130
enable Gemini for the organization, says to contact an administrator,
131
or shows a permission error, see
132
[Turned off or no access](#turned-off-or-no-access). If it shows "URL
133
not found", see [Other errors](#other-errors).
134
135
Once the agent exists, run the check call above (waiting about a minute
136
and retrying up to 3 times if the new agent isn't ready yet). If the user
137
was setting up for a request, send that request again afterwards.
138
- If the check call fails with `Permission 'geminicloudassist.agents.invoke'
139
denied`, `ORG_DISABLED` or `AGENTS_DISABLED`, see
140
[Turned off or no access](#turned-off-or-no-access). If it fails with
141
"Consumer 'organizations/{id}' is invalid", the organization ID is wrong:
142
ask for it again. If it fails with a sign-in error but
143
`gcloud auth application-default print-access-token` works, the sign-in is
144
fine: check the organization (item 1 above); if it's on, the server's
145
connection is the problem: see [Server not connected](#server-not-connected)
146
rather than creating an agent. For another error, see
147
[Troubleshooting](#troubleshooting).
148
3. **Remember and offer to share context:** once the check call works,
149
remember the organization, with the project if there is one (and `agentId`
150
if not their own), and tell the user the operator works, with the
151
organization, the project if any, and the agent. In that same reply, if the
152
`cloud-operator-share-context` skill is available and you don't remember a
153
"Cloud Operator context: shared on" or "declined on" note, ask in one line
154
whether to scan agent instruction files, local memory, skills and
155
workflows, and the repository's GCP docs for context they or their team
156
already have about operating in Google Cloud (environments, projects,
157
product preferences, best practices, architecture guidance, runbooks) and
158
share it with the operator agent's memory — noting they'll see the list
159
first. Read nothing else until they agree.
160
- **Yes:** run `cloud-operator-share-context` (from its collection step).
161
- **No:** remember "Cloud Operator context: declined on {date}", and don't
162
offer again in this conversation.
163
- **No answer:** remember nothing.
164
Then send any request that was waiting when setup started (don't send
165
it again if you already did in step 2).
166
167
## Turned off or no access
168
169
Cloud Operator is turned off for the organization, or the user has no access
170
there. Two cases need no administrator:
171
172
- **"organization-level agents are not enabled"** (it comes only from creating
173
an agent): Cloud Operator isn't available for that organization yet. Tell
174
the user, remember it (see [Troubleshooting](#troubleshooting)), and don't
175
name a role, retry, or send them to the console to create an agent: none of
176
that helps.
177
- **No access in their home organization, just after the first use there:**
178
users get access in their own (home) organization automatically, but only a
179
few minutes after anyone there first uses or creates an operator agent. If
180
the domain of their account (`gcloud config get-value account`) is the
181
organization's display name (`gcloud organizations describe {org_id}
182
--format="value(displayName)"`, its primary domain), or they say the
183
organization is their own company's, tell them, wait about 2 minutes, and
184
repeat the call that failed, for up to about 10 minutes in all. If the
185
organization can't be read and they don't know, repeat it once after about
186
2 minutes. If it still fails, go on below.
187
188
Otherwise only an administrator of the organization can fix either. Use the
189
`cloud-operator-admin-setup` skill from its "Coming from setup" section, with
190
the organization ID and the case (turned off, or no access; for no access, add
191
whether the organization appears in `gcloud organizations list` for their
192
account, since the agent is created in the console): it
193
checks whether the user is an administrator, lets an administrator turn it on
194
or grant access after confirming, and gives anyone else a message for their
195
administrator. Without that skill, tell the user an administrator turns it on
196
at
197
`https://console.cloud.google.com/gemini/admin/onboarding?organizationId={org_id}`,
198
or grants them `roles/geminicloudassist.user` on the organization. For no
199
access, if they'll create the agent in the console and the organization isn't
200
in `gcloud organizations list` for their account, also say the administrator
201
should grant them the Organization Viewer role
202
(`roles/resourcemanager.organizationViewer`) on the organization in the same
203
request: without it the console's agent creation page shows "URL not found".
204
205
Offer another organization meanwhile. When it's fixed, wait about a minute (a
206
few minutes after a role grant, repeating the check call about every 2 minutes
207
for up to about 15 minutes) and run the check call in step 2 again (they
208
may already have an agent). If it's still turned off (an administrator chose
209
**Not now**, or a check after they said it's fixed still shows it off),
210
remember it (see [Troubleshooting](#troubleshooting)).
211
212
## Troubleshooting
213
214
### Server not connected
215
216
When the `google-cloud-operator` MCP server offers no tools, or a call fails
217
with a sign-in error (for example a 401, "invalid authentication credentials",
218
"Incompatible auth server", or "Authentication required"):
219
220
1. Tell the user in one line that Cloud Operator is disconnected, and why if
221
you know (for example, their sign-in expired).
222
2. Give both fix steps, in order (but check the sign-in first if you can):
223
- **If the sign-in works** (`gcloud auth application-default
224
print-access-token` prints a token; you can run it yourself), don't tell
225
them to sign in again. First do **Check the organization** (in step 2 of
226
the setup above): if it's turned off or they have no access, follow
227
[Turned off or no access](#turned-off-or-no-access) instead. If it's on,
228
or you can't run the check (for example, gcloud doesn't run in your
229
sandbox), give the reconnect step, and say the organization wasn't
230
checked if you couldn't.
231
- **If you can't check the sign-in** (for example, gcloud doesn't run in
232
your sandbox), give both steps below: sign in again, then reconnect.
233
- **Sign in again.** The user runs `gcloud auth application-default login`
234
(you can't: it opens a browser). If a call failed, see
235
[Other errors](#other-errors); if `google-cloud-operator` offers no tools,
236
still reconnect. If the server instead signs in through your own MCP
237
settings (OAuth), the user signs in again there.
238
- **Reconnect the server.** In Claude Code: `/mcp`, select
239
`google-cloud-operator`, **Reconnect** (for ADC servers, **Authenticate**
240
doesn't work). In other agents, the user restarts the agent. Don't name a
241
command or menu you aren't sure you have.
242
3. Otherwise, stop, and continue the setup once the user says it's connected.
243
If it still fails after the user reconnects, don't repeat these steps: say
244
their sign-in and the organization look fine, suggest quitting and
245
restarting the agent once (not another Reconnect), and stop there.
246
247
### Other errors
248
249
For an error not listed here, follow the `cloud-operator` skill's
250
troubleshooting table if it's installed.
251
252
When an answer below means Cloud Operator can't be used there (a project
253
without an organization, `RUN_NOT_ALLOWED` on all 3 attempts with
254
`organization`, `ORG_DISABLED` or `AGENTS_DISABLED` (or `getOrgEnablement`
255
showing it off) that stays off, "organization-level agents are not enabled",
256
the console's "URL not found" for an organization the account can list, or a
257
personal account), remember it with what it applies to and the date, so
258
that you don't call it there again until the user asks to try again. Write a
259
`RUN_NOT_ALLOWED` note exactly as "Cloud Operator: not available for
260
organization {org_id} (RUN_NOT_ALLOWED with organization), {date}": the
261
`cloud-operator` skill forgets one that doesn't say "with organization".
262
263
| Error | Likely cause | What to do |
264
| --- | --- | --- |
265
| "… can only be created with an end-user credential" (`USER_CREDENTIAL_REQUIRED`), or "agent_id must be explicitly specified when authenticating as a service account" | The credentials belong to a service account, not to the user | The user signs in with their own account: `gcloud auth application-default login`. If `GOOGLE_APPLICATION_CREDENTIALS` points to a key file, they unset it, because it overrides that sign-in. |
266
| A permission error when creating the agent, or "The caller does not have permission" | The account can't create or use an operator agent in that organization | See [Turned off or no access](#turned-off-or-no-access). |
267
| "agent … is not ready to serve yet" | The agent was just created | Wait about a minute and retry the check call, up to 3 times. |
268
| "This method is not available in this project." (`RUN_NOT_ALLOWED`) from a call that set `project` | Cloud Operator doesn't take project-level calls; this says nothing about the organization | Don't retry with `project`, and don't remember that Cloud Operator isn't available. Make the check call again with `organization` set to the project's organization. |
269
| "This method is not available in this project." (`RUN_NOT_ALLOWED`) from a call that set `organization` | Cloud Operator isn't available for that organization yet | This check can fail intermittently, especially just after the agent is created, so retry up to 2 more times, about 30 seconds apart (3 attempts in all). If all 3 fail, tell the user Cloud Operator isn't available for that organization yet, remember it, and don't send them to create an agent. |
270
| The console's agent creation page shows "URL not found" | Either the account can't read the organization (`resourcemanager.organizations.get`), so the console can't tell that Cloud Operator is available there (usually an account from another domain), or Cloud Operator isn't available for that organization | First check that the page's `organizationId` is the organization from step 1, and that the browser is signed in with the same account as `gcloud` (`gcloud config get-value account`). If both are right, check whether the organization appears in `gcloud organizations list`. Without a working gcloud (not installed, not signed in, or the list command fails), don't treat that as an unlisted organization: ask whether they can open the organization in the console's project picker, and if they can't tell, explain both causes. If it doesn't appear in a listing that worked, or they can't open it in the console, the account can't read it: tell the user that an administrator of the organization can grant them the Organization Viewer role (`roles/resourcemanager.organizationViewer`) on the organization (`gcloud organizations add-iam-policy-binding {org_id} --member="user:{email}" --role="roles/resourcemanager.organizationViewer" --condition=None`), then reload the page. Don't run it unless the user says they're an administrator of the organization and asks you to. If the organization is listed, the account can already read it, so that role won't help: tell the user Cloud Operator isn't available for that organization yet, remember it, and don't send them back to the page. |
271
| "AutoCloud is disabled for organization …" (`ORG_DISABLED`; AutoCloud is the operator's backend name), or "… agents are disabled …" (`AGENTS_DISABLED`) | An administrator turned Cloud Operator off for the organization, or hasn't turned it on | See [Turned off or no access](#turned-off-or-no-access). |
272
| "Permission denied on resource project {id}" | If `{id}` is the organization ID, `organization` was sent without the `organizations/` prefix. Otherwise the project ID is wrong, or the account can't see the project | Send `organizations/{org_id}`, or check the project ID with the user. |
273
| An error that personal accounts aren't supported, or the user signs in with a personal Google Account (for example @gmail.com) | Cloud Operator doesn't support personal Google Accounts yet | Tell the user. |
274