Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Google Drive

Scalekit connector
Open markdown

The Google Drive connector lets your AI agent act in each user's Google Drive account. Each user signs in to Google Drive once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 47 tools.

Tools
47
What they doRead · write · destructive
20 · 20 · 720 read20 write7 destructive
Users sign in with
OAuth app
Your own Google app

What you can do

  • Browse files: list and search files and folders across the user’s Drive
  • Read file content: download and extract text from documents, spreadsheets, and PDFs
  • Create and upload: create new documents and upload files to Drive
  • Manage permissions: share files and update access settings

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Google Drive connection

    In AgentKit > Connections, create a Google Drive connection and copy its redirect URI. The name you give it is the connection_name your code passes. See Configure connections.

  4. Register a Google OAuth app

    Google Drive connections use your own OAuth app. Register one with Google and add the redirect URI you copied.

    Then enter the app's Client ID and Client Secret on the Google Drive connection.

    Console steps with screenshots

    Register your Scalekit environment with the Google Drive connector so Scalekit handles the authentication flow and token lifecycle for you. The connection name you create will be used to identify and invoke the connection programmatically. Then complete the configuration in your application as follows:

    1. Set up auth redirects

      • In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Google Drive and click Create. Click Use your own credentials and copy the redirect URI. It looks like https://<SCALEKIT_ENVIRONMENT_URL>/sso/v1/oauth/<CONNECTION_ID>/callback.

        Copy redirect URI from Scalekit dashboard

      • Navigate to Google Cloud Console → APIs & Services → Credentials. Select + Create Credentials, then OAuth client ID. Choose Web application from the Application type menu.

        Select Web Application in Google OAuth settings

      • Under Authorized redirect URIs, click + Add URI, paste the redirect URI, and click Create.

        Add authorized redirect URI in Google Cloud Console

    2. Enable the Google Drive API

      • In Google Cloud Console, go to APIs & Services → Library. Search for “Google Drive API” and click Enable.
    3. Get client credentials

      • Google provides your Client ID and Client Secret after you create the OAuth client ID in step 1.
    4. Add credentials in Scalekit

      • In Scalekit dashboard, go to AgentKit > Connections and open the connection you created.

      • Enter your credentials:

        Add credentials in Scalekit dashboard

      • Click Save.

  5. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'googledrive'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Google Drive:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'googledrive_get_about',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user signs in once. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • googledrive_export_fileExport a Google Workspace file (such as a Google Doc, Sheet, or Slide) from Google Drive into a specific MIME type and return the converted content.Read-only

    Export Drive File

    Export a Google Workspace file (such as a Google Doc, Sheet, or Slide) from Google Drive into a specific MIME type and return the converted content. Uses OAuth credentials.

    Inputs

    file_idstringrequired
    ID of the Google Workspace file to export
    mime_typestringrequired
    Target MIME type to convert and export the file as. Only certain export MIME types are supported for each source file type.

    Also accepts schema_version and tool_version to pin a version.

  • googledrive_get_aboutGet information about the authenticated Google Drive user and their storage quota, including total, used, and available storage in bytes, and the user's display name and email.Read-only

    Get Drive About Info

    Get information about the authenticated Google Drive user and their storage quota, including total, used, and available storage in bytes, and the user's display name and email.

    Inputs

    fieldsstring
    Fields to include in the response. Defaults to a partial response unless specified.
  • googledrive_get_access_proposalRetrieve a single pending access proposal (a request from another user to be granted access) on a Google Drive file by proposal ID.Read-only

    Get Access Proposal

    Retrieve a single pending access proposal (a request from another user to be granted access) on a Google Drive file by proposal ID. List and Resolve already exist for access proposals but there is no single-proposal Get.

    Inputs

    file_idstringrequired
    ID of the file the access proposal is for
    proposal_idstringrequired
    ID of the access proposal to retrieve
  • googledrive_get_commentRetrieve a single comment on a Google Drive file by comment ID, including its content, author, and replies.Read-only

    Get Drive Comment

    Retrieve a single comment on a Google Drive file by comment ID, including its content, author, and replies. Uses OAuth credentials.

    Inputs

    comment_idstringrequired
    ID of the comment to retrieve
    file_idstringrequired
    ID of the file the comment belongs to
    fieldsstring
    Fields to include in the response. The Drive Comments API requires this parameter on every call.default *
    include_deletedboolean
    Whether to return the comment even if it has been deleted. Deleted comments have their fields limited.default false

    Also accepts schema_version and tool_version to pin a version.

  • googledrive_get_file_metadataRetrieve metadata for a specific file in Google Drive by its file ID.Read-only

    Get File Metadata

    Retrieve metadata for a specific file in Google Drive by its file ID. Returns name, MIME type, size, creation time, and more.

    Inputs

    file_idstringrequired
    The ID of the file to retrieve metadata for
    fieldsstring
    Fields to include in the response
    supports_all_drivesboolean
    Support shared drivesdefault false

    Also accepts schema_version and tool_version to pin a version.

  • googledrive_get_permissionRetrieve details for a single permission on a file or folder in Google Drive by its permission ID.Read-only

    Get File Permission

    Retrieve details for a single permission on a file or folder in Google Drive by its permission ID. Uses OAuth credentials.

    Inputs

    file_idstringrequired
    ID of the file or folder the permission belongs to
    permission_idstringrequired
    ID of the permission to retrieve
    fieldsstring
    Fields to include in the response. Defaults to '*' (all fields).default *

    Also accepts schema_version and tool_version to pin a version.

  • googledrive_get_replyRetrieve a single reply to a comment on a Google Drive file by reply ID.Read-only

    Get Comment Reply

    Retrieve a single reply to a comment on a Google Drive file by reply ID. Create, list, and update already exist for replies but there is no single-reply Get. Uses OAuth credentials.

    Inputs

    comment_idstringrequired
    ID of the comment the reply belongs to
    file_idstringrequired
    ID of the file the comment and reply belong to
    reply_idstringrequired
    ID of the reply to retrieve
    fieldsstring
    Fields to include in the response. The Drive Comments API requires this parameter on every call.default *
    include_deletedboolean
    Whether to return the reply even if it has been deleted. Deleted replies have their fields limited.default false
  • googledrive_get_revisionRetrieve metadata for a single revision of a file in Google Drive by its revision ID.Read-only

    Get File Revision

    Retrieve metadata for a single revision of a file in Google Drive by its revision ID. Uses OAuth credentials.

    Inputs

    file_idstringrequired
    ID of the file the revision belongs to
    revision_idstringrequired
    ID of the revision to retrieve
    fieldsstring
    Fields to include in the response. Defaults to '*' (all fields).default *

    Also accepts schema_version and tool_version to pin a version.

Workflows

Proxy API call
const result = await actions.request({
connectionName: 'googledrive',
identifier: 'user_123',
path: '/drive/v3/files',
method: 'GET',
});
console.log(result);
Download a file

Download a file from Google Drive by its file ID via the Scalekit proxy.

file_id = "<YOUR_FILE_ID>" # file ID from Drive (visible in the file's URL)
output_path = "downloaded.pdf"
response = actions.request(
connection_name='googledrive',
identifier='user_123',
path=f"/drive/v3/files/{file_id}",
method="GET",
query_params={"alt": "media"},
)
with open(output_path, "wb") as f:
f.write(response.content)
print(f"Downloaded: {output_path} ({len(response.content):,} bytes)")
Upload a file

Upload a file to Google Drive in two steps: create the file with the googledrive_create_file tool, then upload its content via the Scalekit proxy. Scalekit injects the OAuth token automatically — your app never handles credentials directly.

To create the file inside a folder, add parent_folder_id to the tool input. This example sends the whole file in one request, which suits small files.

import { readFile } from 'node:fs/promises';
const fileName = 'report.pdf';
const mimeType = 'application/pdf';
const fileBytes = await readFile('report.pdf');
// 1. Create the file
const created = await actions.executeTool({
connector: 'googledrive',
identifier: 'user_123',
toolName: 'googledrive_create_file',
toolInput: { name: fileName, mime_type: mimeType },
});
const fileId = created.data.id;
// 2. Upload the file content
await actions.request({
connectionName: 'googledrive',
identifier: 'user_123',
path: `/upload/drive/v3/files/${fileId}`,
method: 'PATCH',
queryParams: { uploadType: 'media' },
body: fileBytes,
headers: { 'Content-Type': mimeType },
});
console.log(`Uploaded: ${fileName} (File ID: ${fileId})`);
Execute a tool
const result = await actions.executeTool({
connector: 'googledrive',
identifier: 'user_123',
toolName: 'googledrive_get_file_metadata',
toolInput: {},
});
console.log(result);
Google OAuth consent screen verification

Before you use your own Google OAuth credentials in production, understand what end users see on Google’s consent screen when they authorize a connected account.

Audience typeConsent screen behaviorWhen to use
InternalShows your App Name and logo from Branding settingsOnly users in your Google Workspace or Cloud Identity organization can authorize the connector
ExternalShows {env_name}.scalekit.dev until Google verifies your appAny user with a Google account can authorize the connector

Why External is required for most AgentKit connectors:

  • Internal restricts authorization to users in your Google Workspace or Cloud Identity organization. Users with @gmail.com or other Google accounts outside your organization cannot complete OAuth.
  • External is required when end users outside your organization authorize tool access through connected accounts.
  • Organization-managed OAuth clients follow the same rules as personal or developer OAuth clients. Switching to an org-owned client does not bypass Google verification.
  • Until Google completes verification of your External app, users see scalekit.dev on the consent screen. After verification, your App Name and logo appear.

During development:

  • Add Test users under APIs & Services → OAuth consent screen while publishing status is Testing.
  • On unverified apps, users can click Advanced → Go to app (unsafe) to proceed during testing.
  • Google Workspace admins may need to allowlist your OAuth client.

For Google’s verification requirements and timeline, refer to Google’s OAuth consent screen verification guide.