Skip to content

Google Workspace Connector

The Google Workspace connector provides comprehensive access to your organization's Google Workspace environment with 27 live tools spanning Drive, Gmail, Calendar, Sheets, Docs, Tasks, Contacts, Chat, and Admin, plus full ETL ingestion into the knowledge graph.

Authentication

The connector supports two authentication modes: OAuth2 (for user-level access) and Service Account (for domain-wide delegation).

OAuth2

json
{
  "name": "Workspace OAuth",
  "source_type": "google_workspace",
  "config": {
    "auth_mode": "oauth2",
    "client_id": "123456789.apps.googleusercontent.com",
    "client_secret": "GOCSPX-...",
    "refresh_token": "1//0abc...",
    "modules": ["drive", "gmail", "calendar", "sheets"]
  }
}

Service Account

json
{
  "name": "Workspace Service Account",
  "source_type": "google_workspace",
  "config": {
    "auth_mode": "service_account",
    "service_account_json": "{...}",
    "impersonate_email": "admin@example.com",
    "modules": ["drive", "gmail", "calendar", "admin"]
  }
}
VariableRequiredDescription
auth_modeYesAuthentication mode: oauth2 or service_account
client_idOAuth2Google OAuth2 client ID
client_secretOAuth2Google OAuth2 client secret
refresh_tokenOAuth2OAuth2 refresh token
service_account_jsonSAService account JSON key (stringified)
impersonate_emailSAEmail to impersonate via domain-wide delegation
modulesNoModules to enable: drive, gmail, calendar, sheets, docs, tasks, contacts, chat, admin

TIP

For service account mode, enable domain-wide delegation in Google Admin Console and add the required API scopes for each module.

Live Tools (27)

Drive (4)

ToolDescriptionArguments
google_workspace_list_filesList files in Drive with metadatafolder_id?, page_size?, mime_type?
google_workspace_search_filesSearch files by name, content, or typequery, page_size?
google_workspace_get_file_metadataGet detailed metadata for a filefile_id
google_workspace_list_foldersList folders in Driveparent_id?

Gmail (4)

ToolDescriptionArguments
google_workspace_list_emailsList recent emails with subject and senderlabel?, max_results?
google_workspace_search_emailsSearch emails using Gmail query syntaxquery, max_results?
google_workspace_read_emailRead a specific email with full bodymessage_id
google_workspace_send_emailCompose and send an emailto, subject, body, cc?, bcc?

Calendar (4)

ToolDescriptionArguments
google_workspace_list_calendarsList available calendars--
google_workspace_list_eventsList upcoming events from a calendarcalendar_id?, time_min?, time_max?, max_results?
google_workspace_get_eventGet details of a specific eventcalendar_id, event_id
google_workspace_create_eventCreate a new calendar eventcalendar_id, summary, start, end, attendees?, description?

Sheets (3)

ToolDescriptionArguments
google_workspace_list_sheetsList all spreadsheetspage_size?
google_workspace_read_sheetRead data from a sheet rangespreadsheet_id, range
google_workspace_update_sheetWrite data to a sheet rangespreadsheet_id, range, values

Docs (3)

ToolDescriptionArguments
google_workspace_list_docsList all documentspage_size?
google_workspace_read_docRead the content of a documentdocument_id
google_workspace_create_docCreate a new documenttitle, content?

Tasks (2)

ToolDescriptionArguments
google_workspace_list_tasksList tasks from a task listtask_list_id?, show_completed?
google_workspace_create_taskCreate a new tasktask_list_id?, title, notes?, due?

Contacts (1)

ToolDescriptionArguments
google_workspace_list_contactsList contacts with name, email, and phonepage_size?, query?

Chat (3)

ToolDescriptionArguments
google_workspace_list_chat_spacesList Google Chat spacespage_size?
google_workspace_list_messagesList messages in a Chat spacespace_id, page_size?
google_workspace_send_messageSend a message to a Chat spacespace_id, text

Admin (3)

ToolDescriptionArguments
google_workspace_admin_list_usersList users in the domainquery?, max_results?
google_workspace_admin_get_userGet detailed info for a specific useruser_key
google_workspace_admin_list_groupsList groups in the domainquery?, max_results?

Example: Agent Using Google Workspace Tools

User: "Find all Q4 reports shared with me in Drive"

Agent: Let me search your Drive.
→ Calls google_workspace_search_files(query: "Q4 report")
→ Returns: "Found 5 files matching 'Q4 report':
  - Q4 Revenue Report 2025.xlsx (shared by finance@example.com)
  - Q4 OKR Summary.docx (shared by vp-eng@example.com)
  - Q4 Customer Metrics.gsheet (owned by you)
  ..."
User: "Schedule a team standup every Monday at 9am"

Agent: I'll create the recurring event.
→ Calls google_workspace_create_event(
    calendar_id: "primary",
    summary: "Team Standup",
    start: "2026-03-23T09:00:00",
    end: "2026-03-23T09:30:00",
    attendees: ["team@example.com"]
  )
→ Returns: "Created recurring event 'Team Standup' on Mondays at 9:00 AM."

ETL Ingestion

When you trigger a sync, the Google Workspace connector ingests the following resources into the knowledge graph.

Nodes Created

Node LabelPropertiesGoogle Service
DriveFilefile_id, name, mime_type, size, created_time, modified_time, owner, sharedDrive
DriveFolderfolder_id, name, parent_id, created_time, ownerDrive
Emailmessage_id, subject, from, to, date, snippet, label_ids, has_attachmentsGmail
Calendarcalendar_id, summary, time_zone, access_roleCalendar
CalendarEventevent_id, summary, start, end, status, organizer, attendee_count, recurringCalendar
Sheetspreadsheet_id, title, sheet_count, locale, created_timeSheets
Documentdocument_id, title, revision_id, last_modifiedDocs
Tasktask_id, title, status, due, notes, completedTasks
Contactresource_name, display_name, email, phone, organizationContacts
ChatSpacespace_name, display_name, type, member_countChat
ChatMessagemessage_name, sender, create_time, textChat
WorkspaceUseruser_id, primary_email, full_name, is_admin, suspended, org_unitAdmin
WorkspaceGroupgroup_id, email, name, member_count, descriptionAdmin

Relationships Created

RelationshipFromTo
CONTAINSDriveFolderDriveFile
PARENT_OFDriveFolderDriveFolder
OWNED_BYDriveFileWorkspaceUser
SENT_BYEmailWorkspaceUser
HAS_EVENTCalendarCalendarEvent
ATTENDSWorkspaceUserCalendarEvent
AUTHOREDWorkspaceUserDocument
ASSIGNED_TOTaskWorkspaceUser
POSTED_INChatMessageChatSpace
MEMBER_OFWorkspaceUserWorkspaceGroup

Graph Queries

cypher
-- Find files shared across the organization
MATCH (f:DriveFile)-[:OWNED_BY]->(u:WorkspaceUser)
WHERE f.shared = true
RETURN u.primary_email, count(f) AS shared_files
ORDER BY shared_files DESC

-- Map meeting load per user
MATCH (u:WorkspaceUser)-[:ATTENDS]->(e:CalendarEvent)
WHERE e.start >= datetime("2026-03-01T00:00:00")
RETURN u.full_name, count(e) AS meetings
ORDER BY meetings DESC

-- Find users in a group and their recent documents
MATCH (u:WorkspaceUser)-[:MEMBER_OF]->(g:WorkspaceGroup),
      (u)-[:AUTHORED]->(d:Document)
WHERE g.name = "Engineering"
RETURN u.full_name, collect(d.title) AS documents

Configuration Reference

json
{
  "name": "Workspace",
  "source_type": "google_workspace",
  "config": {
    "auth_mode": "oauth2",
    "client_id": "...",
    "client_secret": "...",
    "refresh_token": "...",
    "modules": ["drive", "gmail", "calendar", "sheets", "docs", "tasks", "contacts", "chat", "admin"],
    "drive_shared_drives": true,
    "gmail_max_results": 500,
    "calendar_time_range_days": 90
  }
}
FieldTypeDefaultDescription
auth_modestringrequiredoauth2 or service_account
client_idstringOAuth2 requiredGoogle OAuth2 client ID
client_secretstringOAuth2 requiredGoogle OAuth2 client secret
refresh_tokenstringOAuth2 requiredOAuth2 refresh token
service_account_jsonstringSA requiredService account JSON key (stringified)
impersonate_emailstringSA requiredEmail to impersonate
modulesstring[]allModules to enable
drive_shared_drivesboolfalseInclude shared drives in ingestion
gmail_max_resultsnumber500Max emails to ingest per sync
calendar_time_range_daysnumber90Days of calendar events to ingest

Troubleshooting

ErrorCauseFix
invalid_grantRefresh token expired or revokedRe-authorize the OAuth2 flow to get a new refresh token
403 insufficientPermissionsMissing API scopeAdd the required scope in Google Cloud Console and re-authorize
404 notFoundFile, calendar, or resource does not existVerify the resource ID
429 rateLimitExceededGoogle API quota exceededReduce gmail_max_results or add delays between syncs
Domain-wide delegation not configuredService account lacks delegationEnable delegation in Admin Console > Security > API Controls
accessNotConfiguredAPI not enabled in Cloud ConsoleEnable the required API (Drive, Gmail, Calendar, etc.) in the Google Cloud project

Built by AgentcyLabs. For in-house deployment or Agentcy Cloud (PaaS) access, visit agentcylabs.com.