How to connect Google Cloud to Toolspoke

Let your Toolspoke agents inspect Google Cloud projects, VMs, buckets, Cloud Run services, Cloud SQL and logs, and optionally start or stop a VM. An OAuth client, a refresh token, narrow IAM roles, and an agent that watches your logs.

Google Cloud toolkitInspect projects, Compute Engine, Cloud Storage, Cloud Run, Cloud SQL and Cloud Logging.

Checked against Google Cloud's documentation on 2026-11-25.

Toolspoke's Google Cloud toolkit calls Google's own REST APIs (Resource Manager, Compute Engine, Cloud Storage, Cloud Run, Cloud Logging and Cloud SQL Admin) with an OAuth refresh token you create once. Once it's installed, any agent in the project can use it. This guide sets it up with narrow IAM roles, then builds an agent that reports your Cloud Run errors.

Two things decide what an agent can do: the OAuth scope on the token, and the IAM roles of the Google identity behind it. The scope is broad. IAM is where you limit it.

What an agent can do once it's connected

The toolkit has 12 named actions. Ten of them only read:

  • Projects: list_projects and get_project. An agent calls these first when it doesn't know a project ID.
  • Compute Engine: list_instances lists VMs in one zone, and get_instance reads one in full: status, machine type, disks, network and service accounts.
  • Cloud Storage: list_buckets, and list_objects for names, sizes and update times in a bucket. Object contents are never read.
  • Cloud Run: list_cloud_run_services lists services in one region, and get_cloud_run_service shows which revision is serving and how traffic is split.
  • Logs: query_log_entries runs a Cloud Logging query, newest first.
  • Cloud SQL: list_sql_instances shows each instance's version, tier, region and state.

The other two change things:

ActionWhat it changesKind
start_instanceStarts a stopped Compute Engine VMWrite
stop_instanceStops a running VM. Whatever it served goes away, and local SSD data is lostDestructive

You decide whether your agents may call either one (step 6).

What you need

  • A Google Cloud project to hold the OAuth client, and permission to create credentials there.
  • A Google identity for Toolspoke, ideally a dedicated user rather than your own account, and someone who can grant it IAM roles.
  • A Toolspoke workspace, and a project to install the toolkit in.

Step 1: Give the identity narrow IAM roles

The token your agents use carries the cloud-platform scope. Google describes that scope as permission to "see, edit, configure, and delete" your Google Cloud data. On its own, the scope doesn't limit anything. What the token can actually do is whatever IAM allows the identity that signed in. So grant that identity only these roles, on the projects your agents should see:

RoleCovers
Browser (roles/browser)list_projects, get_project
Compute Viewer (roles/compute.viewer)list_instances, get_instance
Storage Bucket Viewer (roles/storage.bucketViewer)list_buckets
Storage Object Viewer (roles/storage.objectViewer)list_objects
Cloud Run Viewer (roles/run.viewer)list_cloud_run_services, get_cloud_run_service
Logs Viewer (roles/logging.viewer)query_log_entries
Cloud SQL Viewer (roles/cloudsql.viewer)list_sql_instances

A few details from Google's docs:

  • Storage Object Viewer can also read object contents through other tools. If that's too much, grant it only on the buckets your agents need, not on the whole project.
  • Logs Viewer excludes Data Access audit logs. Reading those needs Private Logs Viewer (roles/logging.privateLogViewer). Add it only if your agents should see them.

Only if agents should start or stop VMs: Compute Instance Admin (v1) includes both permissions, but it's full control of instances, disks, snapshots and images. A custom role that holds only compute.instances.start and compute.instances.stop is the narrow option. Grant it on the project, or on the specific VMs.

Step 2: Enable the APIs

In the project that will own the OAuth client, enable the Cloud Resource Manager, Compute Engine, Cloud Storage, Cloud Run Admin, Cloud Logging and Cloud SQL Admin APIs. A call to an API that isn't enabled there fails, even when the IAM role is in place.

Step 3: Create an OAuth client

  1. In the Google Cloud console, open the Clients page for the project from step 2.
  2. If prompted, configure the OAuth consent screen first. If your organization uses Google Workspace, choose the Internal user type. The reason is in step 4.
  3. Choose Create client, pick Desktop app as the application type, enter a Name and choose Create.
  4. Copy the client ID and the client secret.
Google Cloud console
  1. Clients
  2. Create client
Application type
Desktop app
Name
toolspoke
Create
Copy the client ID and the client secret. Illustration of Google Cloud console's screen. The labels are Google Cloud console's; the layout is ours.

Step 4: Generate a refresh token

Run Google's OAuth flow for desktop apps once with the client from step 3. Request the scope https://www.googleapis.com/auth/cloud-platform with offline access, sign in as the identity from step 1, and keep the refresh token it returns. Any Google OAuth client library's installed-app flow will do this.

Google's rules for refresh tokens matter here:

  • If the consent screen is External and its publishing status is Testing, Google issues refresh tokens that expire after 7 days. Use the Internal user type if your organization can.
  • A refresh token that goes six months unused stops working.
  • Google allows 100 refresh tokens per Google Account per OAuth client. Minting a 101st silently invalidates the oldest. Don't reuse this client for other experiments.
  • If the identity revokes the app's access, or an admin restricts the service, the token stops working.

Step 5: Install the Google Cloud toolkit in Toolspoke

  1. In Toolspoke, open the project your agents work in. Find Google Cloud in the marketplace and add it.
  2. Paste the OAuth client ID, OAuth client secret and OAuth refresh token.
  3. Enter the Default project ID, for example acme-prod. An agent can still name any other project the identity can see.
  4. Optionally, set a Default Compute Engine zone (such as us-central1-a) and a Default Cloud Run region (such as us-central1). Compute Engine and Cloud Run are listed one zone or region at a time, so set these to where most of your workloads run.
CredentialGoogle Cloud
OAuth client ID
••••••••••••••••
Google Cloud console → Clients → Create client, with application type Desktop app. Enable the Compute Engine, Cloud Storage, Cloud Run Admin, Cloud Logging and Cloud SQL Admin APIs on the same project.
OAuth client secret
••••••••••••••••
Shown next to the OAuth client ID in the Google Cloud console.
OAuth refresh token
••••••••••••••••
Generate once with the https://www.googleapis.com/auth/cloud-platform scope and offline access, then paste it here.
Default project ID
acme-prod
Used whenever an action is called without an explicit project. Any project the identity can see may still be passed per call.
Default Compute Engine zoneoptional
us-central1-a
Used by the Compute Engine actions when no zone is given.
Default Cloud Run regionoptional
us-central1
Used by the Cloud Run actions when no location is given.

list_projects answered. The credential works.

Save and test
The Google Cloud toolkit's credential card in your Toolspoke project, with its real fields.

Toolspoke checks the connection with list_projects.

The client secret and refresh token are encrypted at rest and attached to each request by the gateway. The agent never sees them, and they never appear in the arguments an agent sends or in the audit log.

Step 6: Decide what agents may change

In the project's toolkit settings, Google Cloud's actions are grouped as read, write and destructive. Each one can be switched on or off for everyone in the project.

A sensible start: leave the ten reads on, and switch off stop_instance until the team trusts how it's used. start_instance is the safer of the two, since it reverses a stop, so turn it on if people want an agent to bring a stopped box back. An action that's switched off can't be called, whatever the prompt says. If you didn't grant the start and stop permissions in step 1, Google refuses both anyway.

Google Cloud actions in your project

Agents can call 11 of 12, and 1 of those can change something.

Read
Looks, changes nothing.
  • list_projectsList the Google Cloud projects this identity can see, with their project IDs, numbers, lifecycle state and labels.
  • get_projectFetch one project by ID: its number, lifecycle state, labels and parent organization or folder.
  • list_instancesList the Compute Engine VMs in one zone, with their machine type, status, network interfaces and disks.
  • get_instanceFetch one Compute Engine VM in full: status, machine type, disks, network interfaces, service accounts, scheduling and labels.
  • list_bucketsList the Cloud Storage buckets in a project, with their location, storage class and creation time.
  • list_objectsList the objects in a Cloud Storage bucket with their size, content type and update time — names and metadata only, never contents.
  • list_cloud_run_servicesList the Cloud Run services in one region, with their URL, image, traffic split and ready condition.
  • get_cloud_run_serviceFetch one Cloud Run service in full: the container image and revision currently serving, resource limits, concurrency, scaling bounds, traffic split and its ready condition.
  • query_log_entriesQuery Cloud Logging for log entries in a project.
  • list_sql_instancesList the Cloud SQL instances in a project, with their database version, tier, region, state and connection name.
Write
Changes something you can change back.
  • start_instanceStart a stopped Compute Engine VM.
Delete
Removes or overrides something for good.
  • stop_instanceStop a running Compute Engine VM.
Try the switches. They start the way this guide suggests; nothing here changes your project.

Every call is recorded with the agent and person behind it, the request, the response and the duration.

Step 7: Build an agent that uses it

In Toolspoke, create an agent and describe its job in one sentence. The builder proposes the instructions, the toolkits it needs, a schedule and where it should answer. You add or skip each one, then create the agent. Every piece stays editable afterwards.

The same agent answers when someone asks it in Slack or emails it, and it replies in the thread it was asked in. It only reads, so it can't start or stop anything.

Try it

Ask the agent the way you'd ask whoever is on call:

  • Which VMs are running in us-central1-a in acme-prod, and what machine type is each?
  • Which revision of the checkout service is serving traffic in Cloud Run right now? When was it deployed?
  • Show ERROR logs from the checkout Cloud Run service in the last hour, grouped by message.
  • Is the orders-db Cloud SQL instance RUNNABLE, and what tier is it on?
  • List what's under exports/2026-11/ in the acme-reports bucket, with sizes.
  • batch-worker-3 is stopped. Start it and tell me when it's RUNNING.

The last one needs start_instance switched on and the start permission from step 1. The Google Cloud toolkit page lists every action.

Troubleshooting

Every call fails at the token step.

The refresh token is no longer valid. It's usually the 7-day expiry of an External app in Testing, or the token was revoked or replaced. Fix the consent screen (step 3), mint a new token (step 4) and paste it in.

One product fails with a message that its API is disabled.

Enable that API in the OAuth client's project (step 2).

403 on one product while the others work.

The identity lacks that product's role on that project. Add it from the table in step 1.

listinstances or listcloudrunservices comes back empty.

They only look at one zone or region. Ask the agent to use the zone or region where the resource lives, or change the default.

Some logs you expect are missing.

Data Access audit logs need Private Logs Viewer, not Logs Viewer.

Questions

Can an agent delete a VM, a bucket or a database?

No. The toolkit has only the 12 actions above. Nothing else in Google Cloud's APIs, such as deleting instances, writing objects or changing IAM, is reachable through it, even though the scope would allow it.

Why the broad cloud-platform scope?

It's the scope these APIs accept. Narrow access by giving the identity narrow IAM roles (step 1), not by changing the scope.

Does the agent see the client secret or the refresh token?

No. The gateway attaches them to the request. They're never shown to the agent and are masked in the audit log.

Can I use a service account?

The toolkit stores an OAuth client and a refresh token, not a service account key. You can mint the refresh token for a dedicated user that holds only the roles above.

Connect Google Cloud to Toolspoke

Install Google Cloud in a project, give it to an agent, and every call is checked and logged.