fix(google-workspace): adopt Google's definitions over any shipped REST definition after the switch back (#22874)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents use Google Workspace through a connection whose catalog rows
save each action's definition, and a catalog refresh holds a changed
definition for review
> - #22815 moved Gmail, Drive, Docs, Sheets, Slides and Calendar from
Paperclip's REST tools back to Google's MCP servers
> - It said that the first refresh after the switch replaces saved REST
definitions with no hold, but it recognised only the current REST
schemas
> - Rows saved by the first REST launch (#22634) carry older schemas, so
the refresh held 34 of 36 actions on a staging test instance and agents
lost all Google actions
> - This pull request recognises every shipped REST schema, so the
switch back holds none of these actions
> - The benefit is that the switch back keeps agents working with no
admin review, and a Google definition that Paperclip never shipped is
still held

## Linked Issues or Issue Description

Refs #22815

**What happened?**

On a staging test instance (build 1b4ebec), a Google Workspace
connection ran on the REST tools since Nov 23. After the deploy, the
first catalog refresh set 34 of 36 Google actions to `quarantined` with
`pending_review`. Agents lost every Google action until an admin reviews
them. `gmail__list_threads` and `gmail__search_messages` became
`disabled` with `mcp_tool_removed`, which is expected.

Root cause: `formerPaperclipDefinedTool` compared the saved schema hash
with the hash of the REST definition in the current build only. #22706
changed all 36 REST input schemas (it adds `additionalProperties:
false`, and it changes `list_threads` and `search_threads`). A row that
a refresh saved on a #22634 build, and that no refresh updated after
#22706, has a #22634 hash. I computed the hashes from the code at
b865dd1 (#22634), 6a07420 (#22706) and master: all 36 hashes differ
between #22634 and #22706, and master equals #22706. So every saved row
failed the match, and the refresh held it.

**What did you expect to happen?**

The refresh saves Google's definitions with no hold. It keeps Off, Ask
first and the review fields of each action.

**Steps to reproduce**

1. Connect Google Workspace on Google's MCP servers.
2. Switch the six services to `paperclip_rest` and refresh the catalog.
3. Make the saved rows carry the #22634 input schemas (a refresh on a
#22634 build does this).
4. Switch back to `google_mcp` and refresh the catalog.
5. See that every action is `quarantined` with `pending_review`.

## What Changed

- `server/src/google-workspace-rest-tools/shipped-schema-hashes.ts`
lists the input schema hash of each REST tool for each shipped revision
(#22634 and #22706).
- `shippedPaperclipSchemaHashes` replaces `formerPaperclipDefinedTool`.
A refresh does not hold an action when its saved schema hash is in that
list.
- No automatic repair for actions that are already held. The hold
replaced the saved definition with Google's, so the row does not show
its earlier definition. I tried a release from call history
(`tool_invocations.catalog_schema_hash` after the last successful
refresh before the hold). Review showed that a refresh can save rows and
stop before it writes its success audit (for example, at a restart).
Then a call from before that refresh can wrongly prove a later Google
change. No other record proves the earlier definition, so there is no
safe automatic signal. These actions stay held, and a person reviews
them. A test shows this.
- `fixtures/input-schemas-22634.json` keeps the #22634 schemas for the
tests.
- The folder README and `doc/memory/google-connector-memory.md` describe
the change.

## Verification

- `pnpm exec vitest run
src/__tests__/google-workspace-mcp-transport.test.ts` (in `server/`): 25
tests pass with the boundary test.
- Red before the fix: "adopts Google's definitions with no hold when the
rows carry the #22634 REST definitions" failed with 10 of 10 actions
held.
- The tests run the real catalog refresh against a fake Google that
serves REST and MCP. They follow the history: MCP rows, then REST rows
(#22634 and #22706), with review fields, Off and Ask first, then the
switch back.
- "holds for review a Google definition that Paperclip never shipped": a
saved hash that Paperclip never shipped is held at the switch, and a
later change in Google's schema is held.
- "keeps an action that a switch before this fix held for review held":
a later refresh does not release an action that an earlier switch held.
- `src/services/google-workspace-rest-dispatch.test.ts`: the list
contains the current hash of every REST tool, and the hash of every
#22634 schema in the fixture.
- `pnpm verify` exited 2 (the README is a broad input). I ran the 21
test files that use the catalog refresh or the REST dispatch. All pass
except `email-channels.integration.test.ts`, which fails in this
worktree because a bundled skill file is not on disk. That file does not
touch this change. Required CI covers the rest.

## Risks

- Connections that a switch already held (the staging test instance)
keep those actions held. An admin must review them.
- A future change to a REST schema must add its hash to the list. A test
fails when it is missing.
- No migration. No change for connections that are not Google Workspace.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with
tool use (shell, file edits, test runs).

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 authored and GitHub committed 2026-11-24 22:40:57 -06:00
1 parent cd8bcfba16
commit aeafc6a190
10 files changed
+341 -12

No files matched your search

+1
View File
@@ -115,6 +115,7 @@ What Paperclip still does before it sends a call to Google's MCP server:
- A confirmation question from Google (MCP elicitation) goes on the task's
question card for a person. Skipping it sends "decline"; until it is
answered, the call stops again and nothing is changed.
- Switch-back fix (Nov 25, `fix/google-mcp-adopt-saved-rest-definitions`): #22815 recognised only the current REST schemas, so rows saved by #22634 (before the #22706 strict schemas) were held for review on the staging tester (34 of 36). A refresh now adopts Google's definition for any shipped REST schema hash (`shipped-schema-hashes.ts`). Actions already held stay held for a person to review: the hold replaced the saved definition, and no record proves the row's definition before the hold (an auto-release from call history was dropped after review, because a refresh can save rows and stop before its audit).
What only the REST tools did, and does not happen on MCP:
@@ -1,4 +1,5 @@
import { randomUUID } from "node:crypto";
import { readFileSync } from "node:fs";
import { and, eq } from "drizzle-orm";
import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from "vitest";
import {
@@ -10,6 +11,7 @@ import {
type GoogleWorkspaceService, type GoogleWorkspaceToolTransport,
} from "@paperclipai/shared";
import * as restDispatch from "../services/google-workspace-rest-dispatch.js";
import { stableHash } from "../services/tool-catalog-hash.js";
import { issueThreadInteractionService } from "../services/issue-thread-interactions.js";
import { forgetMcpHttpSessions, MCP_MODERN_PROTOCOL_VERSION } from "../services/mcp-http.js";
import { toolAccessService } from "../services/tool-access.js";
@@ -27,6 +29,7 @@ vi.mock("../services/google-workspace-rest-dispatch.js", async (importOriginal)
...actual,
callGoogleWorkspaceRest: vi.fn(actual.callGoogleWorkspaceRest),
probeGoogleWorkspaceRest: vi.fn(actual.probeGoogleWorkspaceRest),
googleWorkspaceRestShippedSchemaHashes: vi.fn(actual.googleWorkspaceRestShippedSchemaHashes),
};
});
@@ -65,6 +68,8 @@ const READ_ONLY_PERMISSIONS = ["gmail.readonly", "drive.readonly", "documents.re
"calendar.calendarlist.readonly", "calendar.events.freebusy", "calendar.events.readonly"];
const allowlisted = (keep: (name: string) => boolean = () => true) => LAUNCH_SERVICES
.flatMap((service) => googleWorkspaceServiceToolNames(service).map((name) => `${service}__${name}`)).filter(keep).sort();
const SCHEMAS_22634: Record<string, Record<string, unknown>> = JSON.parse(
readFileSync(new URL("../google-workspace-rest-tools/fixtures/input-schemas-22634.json", import.meta.url), "utf8"));
const names = (catalog: Array<{ toolName: string }>) => catalog.map((entry) => entry.toolName).sort();
type Confirmation = "none" | "legacy" | "modern";
@@ -427,4 +432,92 @@ const support = await getEmbeddedPostgresTestSupport();
await expect(f.call("gmail__create_draft", { to: ["sam@example.test"], subject: "Thursday", body: "Thursday works." }))
.rejects.toMatchObject({ reasonCode: "approval_required" });
});
describe("a connection saved on REST before the switch back", () => {
const savedRows = (connectionId: string) => db.select().from(toolCatalogEntries).where(eq(toolCatalogEntries.connectionId, connectionId));
const byName = async (connectionId: string) => new Map((await savedRows(connectionId)).map((row) => [row.toolName, row]));
const permissions = ["gmail.readonly", "gmail.compose", "documents.readonly"];
async function savedOnRest(options: { askFirst?: string[]; off?: string[] } = {}) {
const f = await connectWorkspace({ permissions, ...options });
expect((await byName(f.connectionId)).get("gmail__get_message")?.inputSchema).toEqual(SCHEMAS.get_message);
useTransport("paperclip_rest");
forgetMcpHttpSessions(f.connectionId);
const onRest = await f.service.refreshCatalog(f.connectionId, f.actor);
expect(onRest.catalog.filter((entry) => entry.status === "quarantined")).toEqual([]);
expect((await byName(f.connectionId)).get("gmail__get_message")?.inputSchema).not.toEqual(SCHEMAS.get_message);
return f;
}
async function backOnGoogle(f: Awaited<ReturnType<typeof connectWorkspace>>) {
useTransport("google_mcp");
forgetMcpHttpSessions(f.connectionId);
return f.service.refreshCatalog(f.connectionId, f.actor);
}
it.each(["#22634", "#22706"])("adopts Google's definitions with no hold when the rows carry the %s REST definitions, keeping Off, Ask first and review", async (revision) => {
const f = await savedOnRest({ off: ["gmail__search_threads"], askFirst: ["gmail__create_draft"] });
const reviewedAt = new Date("2026-11-23T20:00:00Z");
for (const row of await savedRows(f.connectionId)) {
const old = revision === "#22634" ? SCHEMAS_22634[row.toolName] : undefined;
await db.update(toolCatalogEntries).set({
reviewedAt, reviewedByUserId: f.actor.actorId,
...(old ? { inputSchema: old, schemaHash: stableHash(old) } : {}),
}).where(eq(toolCatalogEntries.id, row.id));
}
const refreshed = await backOnGoogle(f);
expect(refreshed.quarantinedCount).toBe(0);
expect(refreshed.catalog.filter((entry) => entry.status !== "active")).toEqual([]);
const saved = await byName(f.connectionId);
expect(saved.get("gmail__get_message")?.inputSchema).toEqual(SCHEMAS.get_message);
expect([...saved.values()].every((row) => row.reviewedAt?.getTime() === reviewedAt.getTime() && row.reviewedByUserId === f.actor.actorId)).toBe(true);
const offered = (await f.listed()).map((tool) => tool.upstreamToolName);
expect(offered).toContain("gmail__get_message");
expect(offered).not.toContain("gmail__search_threads");
await expect(f.call("gmail__get_message", { messageId: "msg1" })).resolves.toMatchObject({ status: "completed" });
await expect(f.call("gmail__create_draft", { to: ["sam@example.test"], subject: "Thursday", body: "Thursday works." }))
.rejects.toMatchObject({ reasonCode: "approval_required" });
});
it("holds for review a Google definition that Paperclip never shipped", async () => {
const f = await savedOnRest();
const unknown = await db.update(toolCatalogEntries).set({ schemaHash: "a-definition-paperclip-never-shipped" })
.where(and(eq(toolCatalogEntries.connectionId, f.connectionId), eq(toolCatalogEntries.toolName, "gmail__get_thread"))).returning();
expect(unknown).toHaveLength(1);
const switched = await backOnGoogle(f);
expect(switched.catalog.filter((entry) => entry.status === "quarantined").map((entry) => entry.toolName)).toEqual(["gmail__get_thread"]);
const original = SCHEMAS.get_message;
SCHEMAS.get_message = { ...original, properties: { ...(original.properties as object), exportTo: { type: "string" } } };
try {
forgetMcpHttpSessions(f.connectionId);
const changed = await f.service.refreshCatalog(f.connectionId, f.actor);
expect(changed.quarantinedCount).toBe(1);
expect(changed.catalog.filter((entry) => entry.status === "quarantined").map((entry) => entry.toolName).sort())
.toEqual(["gmail__get_message", "gmail__get_thread"]);
expect((await byName(f.connectionId)).get("gmail__get_message")?.quarantineReason).toBe("pending_review");
} finally {
SCHEMAS.get_message = original;
}
});
it("keeps an action that a switch before this fix held for review held, because the hold replaced the saved REST definition", async () => {
const f = await savedOnRest();
await expect(f.call("gmail__get_message", { messageId: "msg1" })).resolves.toMatchObject({ status: "completed" });
vi.mocked(restDispatch.googleWorkspaceRestShippedSchemaHashes).mockReturnValue([]);
try {
const held = await backOnGoogle(f);
expect(held.catalog.filter((entry) => entry.status === "active")).toEqual([]);
} finally {
vi.mocked(restDispatch.googleWorkspaceRestShippedSchemaHashes).mockRestore();
}
forgetMcpHttpSessions(f.connectionId);
const later = await f.service.refreshCatalog(f.connectionId, f.actor);
expect(later.quarantinedCount).toBe(0);
expect(later.catalog.filter((entry) => entry.status === "active")).toEqual([]);
expect((await byName(f.connectionId)).get("gmail__get_message")).toMatchObject({ status: "quarantined", quarantineReason: "pending_review" });
expect(await f.listed()).toEqual([]);
});
});
});
@@ -334,11 +334,25 @@ A connection whose catalog was refreshed while its services were on
`paperclip_rest` has this folder's definitions saved. After the switch back,
agents see those saved definitions until the next catalog refresh, and the
argument checks use them. That refresh saves Google's definitions. It does not
hold an action for review when the saved row is this folder's definition
(`formerPaperclipDefinedTool` in
hold an action for review when the saved row's schema hash is one of this
folder's shipped definitions (`shippedPaperclipSchemaHashes` in
`server/src/services/connectors/paperclip-defined-tools.ts` and the hold rule
in `server/src/services/tool-access/catalog/publication.ts`), and it keeps Off
and Ask first. An action that Google's server does not list (for example Gmail
in `server/src/services/tool-access/catalog/publication.ts`), and it keeps Off,
Ask first and the review fields.
`shipped-schema-hashes.ts` lists the input schema hash of every revision of
every tool that a connection could have saved: the first launch (#22634) and
the strict-argument revision (#22706). `fixtures/input-schemas-22634.json`
holds the #22634 schemas. A test fails when a tool's current schema is not in
the list, so add the new hash whenever a schema changes.
The first switch-back refresh on builds before this list held each action
whose row carried the #22634 schemas (`quarantined`, `pending_review`). That
hold replaced the saved definition with Google's. No record keeps the earlier
definition: a refresh can save rows and stop before it writes its audit event,
so neither the audit history nor the call records prove which definition a row
had just before the hold. A refresh does not release such an action. A person
reviews it. An action that Google's server does not list (for example Gmail
`get_draft`, `list_threads` or `search_messages`, if Google does not have
them) is removed by that refresh.
@@ -0,0 +1,38 @@
{
"calendar__create_event": {"type":"object","properties":{"summary":{"type":"string","description":"Required. Title."},"startTime":{"type":"string","description":"Required. Start (ISO 8601, for example 2026-04-30T10:00:00). Pass the local time with no UTC offset and no trailing Z (for example 2026-04-30T10:00:00); include an offset only if the user stated one. If the user named a time zone, put its IANA name in timeZone."},"endTime":{"type":"string","description":"Required. End (ISO 8601, for example 2026-04-30T11:00:00), after startTime. Same rules as startTime. For an all-day event the end is exclusive: a one-day event on April 30 ends 2026-05-01."},"attendeeEmails":{"type":"array","items":{"type":"string"},"description":"Deprecated: use attendees."},"attendees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Output only. Profile ID."},"email":{"type":"string","description":"Required. The attendee's email address."},"displayName":{"type":"string","description":"Optional. Name."},"organizer":{"type":"boolean","description":"Output only. Whether the attendee is the organizer."},"self":{"type":"boolean","description":"Output only. Whether this entry is the calendar this copy of the event is on."},"resource":{"type":"boolean","description":"Optional. Whether the attendee is a resource such as a room. Can only be set when the attendee is added."},"optionalAttendee":{"type":"boolean","description":"Optional. Whether the attendee is optional."},"responseStatus":{"type":"string","enum":["needsAction","declined","tentative","accepted"],"description":"Optional. Response status."},"comment":{"type":"string","description":"Output only. Response comment."},"additionalGuests":{"type":"integer","description":"Optional. Number of additional guests."}},"required":["email"]},"description":"Optional. Attendees."},"recurrenceData":{"type":"array","items":{"type":"string"},"description":"Optional. RRULE, RDATE or EXDATE lines (RFC 5545), for example RRULE:FREQ=WEEKLY;COUNT=10."},"overrideReminders":{"type":"array","items":{"type":"object","properties":{"method":{"type":"string","enum":["email","popup"],"description":"Delivery method."},"minutes":{"type":"integer","description":"Minutes before the event that the reminder fires."}},"required":["method","minutes"]},"description":"Optional. Reminders that replace the calendar's defaults, at most 5."},"attachments":{"type":"array","items":{"type":"object","properties":{"fileUrl":{"type":"string","description":"Required. Link to the file."},"title":{"type":"string","description":"Optional. Title."}},"required":["fileUrl"]},"description":"Optional. File attachments, as Google Drive file links."},"calendarId":{"type":"string","description":"Optional. ID of the calendar, an email address that list_calendars can resolve. Default: the primary calendar."},"description":{"type":"string","description":"Optional. Description. Can contain HTML."},"location":{"type":"string","description":"Optional. Location."},"allDay":{"type":"boolean","description":"Optional. Whether the event takes whole days. When true, only the dates of startTime and endTime are used."},"timeZone":{"type":"string","description":"Optional. IANA time zone name (for example America/Los_Angeles) the event is created in. Set it only when the user states a time zone, and always set it when they do. When unset, the calendar's own time zone is used."},"notificationLevel":{"type":"string","enum":["NOTIFICATION_LEVEL_UNSPECIFIED","NONE","EXTERNAL_ONLY","ALL"],"description":"Optional. Which email notifications to send. NONE: none. EXTERNAL_ONLY: attendees outside the organizer's domain only. ALL: all attendees. Default: ALL."},"addGoogleMeetUrl":{"type":"boolean","description":"Optional. Create a Google Meet link for the event. Default: false."},"visibility":{"type":"string","enum":["default","public","private"],"description":"Optional. Visibility: default (the calendar's default), public, or private (only attendees see details)."},"colorId":{"type":"string","description":"Optional. Event color ID, \"1\" to \"11\"."},"googleMeetUrl":{"type":"string","description":"Optional. An existing Google Meet link or meeting ID to attach. Overrides addGoogleMeetUrl."},"guestPermissions":{"type":"object","properties":{"guestsCanInviteOthers":{"type":"boolean","description":"Optional. Whether guests can invite others."},"guestsCanModify":{"type":"boolean","description":"Optional. Whether guests can change the event."},"guestsCanSeeGuests":{"type":"boolean","description":"Optional. Whether guests can see the other guests."}},"description":"Optional. Guest permissions."},"availability":{"type":"string","enum":["AVAILABILITY_UNSPECIFIED","AVAILABILITY_BUSY","AVAILABILITY_FREE"],"description":"Optional. Whether the event blocks time. Unspecified means busy."},"eventType":{"type":"string","enum":["EVENT_TYPE_UNSPECIFIED","DEFAULT","OUT_OF_OFFICE","FOCUS_TIME","WORKING_LOCATION","BIRTHDAY","FROM_GMAIL"],"Line truncated
"calendar__delete_event": {"type":"object","properties":{"eventId":{"type":"string","description":"Required. ID of the event or occurrence to delete. A recurring series' ID is refused."},"calendarId":{"type":"string","description":"Optional. ID of the calendar, an email address that list_calendars can resolve. Default: the primary calendar."},"notificationLevel":{"type":"string","enum":["NOTIFICATION_LEVEL_UNSPECIFIED","NONE","EXTERNAL_ONLY","ALL"],"description":"Optional. Which email notifications to send. NONE: none. EXTERNAL_ONLY: attendees outside the organizer's domain only. ALL: all attendees. Default: ALL."}},"required":["eventId"]},
"calendar__get_event": {"type":"object","properties":{"eventId":{"type":"string","description":"Required. Event ID, from list_events or search_events."},"calendarId":{"type":"string","description":"Optional. ID of the calendar, an email address that list_calendars can resolve. Default: the primary calendar."}},"required":["eventId"]},
"calendar__list_calendars": {"type":"object","properties":{"pageSize":{"type":"integer","description":"Optional. Maximum results per page. Default 100, at most 250."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from the previous page."}}},
"calendar__list_events": {"type":"object","properties":{"eventTypeFilter":{"type":"array","items":{"type":"string"},"description":"Deprecated: use eventType."},"eventType":{"type":"array","items":{"type":"string","enum":["EVENT_TYPE_UNSPECIFIED","DEFAULT","OUT_OF_OFFICE","FOCUS_TIME","WORKING_LOCATION","BIRTHDAY","FROM_GMAIL"]},"description":"Optional. Event types to return. Default: DEFAULT, OUT_OF_OFFICE, FOCUS_TIME and FROM_GMAIL."},"calendarId":{"type":"string","description":"Optional. ID of the calendar, an email address that list_calendars can resolve. Default: the primary calendar."},"pageSize":{"type":"integer","description":"Optional. Maximum results per page. Default 100, at most 250."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from the previous page."},"startTime":{"type":"string","description":"Optional. Start of the time range (ISO 8601), before endTime. Default: now. Pass the local time with no UTC offset and no trailing Z (for example 2026-04-30T10:00:00); include an offset only if the user stated one. If the user named a time zone, put its IANA name in timeZone."},"endTime":{"type":"string","description":"Optional. End of the time range (ISO 8601), after startTime. Default: 7 days after startTime. Pass the local time with no UTC offset and no trailing Z (for example 2026-04-30T10:00:00); include an offset only if the user stated one. If the user named a time zone, put its IANA name in timeZone."},"timeZone":{"type":"string","description":"Optional. IANA time zone name (for example America/Los_Angeles) for reading times without an offset, and for the times in the result. Set it only when the user states a time zone, and always set it when they do. When unset, the calendar's own time zone is used."},"orderBy":{"type":"string","enum":["default","startTime","startTimeDesc","lastModified"],"description":"Optional. default: unspecified but stable order. startTime: start time ascending. startTimeDesc: start time descending. lastModified: last change ascending."},"fullText":{"type":"string","description":"Optional. Free-text, case-insensitive search over title, description, location and attendees. Every term must match."}}},
"calendar__respond_to_event": {"type":"object","properties":{"eventId":{"type":"string","description":"Required. ID of the event to respond to."},"responseStatus":{"type":"string","enum":["declined","tentative","accepted"],"description":"Required. The user's response: accepted, tentative or declined."},"calendarId":{"type":"string","description":"Optional. ID of the calendar, an email address that list_calendars can resolve. Default: the primary calendar."},"notificationLevel":{"type":"string","enum":["NOTIFICATION_LEVEL_UNSPECIFIED","NONE","EXTERNAL_ONLY","ALL"],"description":"Optional. Which email notifications to send. NONE: none. EXTERNAL_ONLY: attendees outside the organizer's domain only. ALL: all attendees. Default: EXTERNAL_ONLY."},"responseComment":{"type":"string","description":"Optional. Comment sent with the response."}},"required":["eventId","responseStatus"]},
"calendar__search_events": {"type":"object","properties":{"query":{"type":"string","description":"Required. Words to search for (case-insensitive)."},"pageSize":{"type":"integer","description":"Optional. Maximum results per page. Default 25, at most 250."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from the previous page."}},"required":["query"]},
"calendar__suggest_time": {"type":"object","properties":{"attendeeEmails":{"type":"array","items":{"type":"string"},"description":"Required. Email addresses of the people to find free time for, at most 50. Include the user's own address to count their calendar."},"startTime":{"type":"string","description":"Required. Start of the search range (ISO 8601). Pass the local time with no UTC offset and no trailing Z (for example 2026-04-30T10:00:00); include an offset only if the user stated one. If the user named a time zone, put its IANA name in timeZone."},"endTime":{"type":"string","description":"Required. End of the search range (ISO 8601), at most 62 days after startTime. Pass the local time with no UTC offset and no trailing Z (for example 2026-04-30T10:00:00); include an offset only if the user stated one. If the user named a time zone, put its IANA name in timeZone."},"timeZone":{"type":"string","description":"Optional. IANA time zone name (for example America/Los_Angeles) for reading the times, for the daily hours in preferences, and for the times in the result. Set it only when the user states a time zone, and always set it when they do. When unset, the calendar's own time zone is used."},"durationMinutes":{"type":"integer","description":"Optional. Shortest free period to return, in minutes. Default: 30."},"preferences":{"type":"object","description":"Optional. Preferences for the suggestions.","properties":{"startHour":{"type":"string","description":"Optional. Earliest time of day, HH:mm (24-hour)."},"endHour":{"type":"string","description":"Optional. Latest time of day, HH:mm (24-hour); 24:00 means midnight. Must be later than startHour."},"excludeWeekends":{"type":"boolean","description":"Optional. Leave out Saturdays and Sundays."},"pageSize":{"type":"integer","description":"Optional. Most suggestions to return. Default: 5, at most 50."}}}},"required":["attendeeEmails","startTime","endTime"]},
"calendar__update_event": {"type":"object","properties":{"eventId":{"type":"string","description":"Required. Event ID, from list_events or search_events."},"addedAttendeeEmails":{"type":"array","items":{"type":"string"},"description":"Deprecated: use addedAttendees."},"addedAttendees":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Output only. Profile ID."},"email":{"type":"string","description":"Required. The attendee's email address."},"displayName":{"type":"string","description":"Optional. Name."},"organizer":{"type":"boolean","description":"Output only. Whether the attendee is the organizer."},"self":{"type":"boolean","description":"Output only. Whether this entry is the calendar this copy of the event is on."},"resource":{"type":"boolean","description":"Optional. Whether the attendee is a resource such as a room. Can only be set when the attendee is added."},"optionalAttendee":{"type":"boolean","description":"Optional. Whether the attendee is optional."},"responseStatus":{"type":"string","enum":["needsAction","declined","tentative","accepted"],"description":"Optional. Response status."},"comment":{"type":"string","description":"Output only. Response comment."},"additionalGuests":{"type":"integer","description":"Optional. Number of additional guests."}},"required":["email"]},"description":"Optional. Attendees to add."},"removedAttendeeEmails":{"type":"array","items":{"type":"string"},"description":"Optional. Email addresses of attendees to remove."},"overrideReminders":{"type":"array","items":{"type":"object","properties":{"method":{"type":"string","enum":["email","popup"],"description":"Delivery method."},"minutes":{"type":"integer","description":"Minutes before the event that the reminder fires."}},"required":["method","minutes"]},"description":"Optional. When set, replaces all of the event's reminders."},"addedAttachments":{"type":"array","items":{"type":"object","properties":{"fileUrl":{"type":"string","description":"Required. Link to the file."},"title":{"type":"string","description":"Optional. Title."}},"required":["fileUrl"]},"description":"Optional. File attachments to add, as Google Drive file links."},"removedAttachmentFileUrls":{"type":"array","items":{"type":"string"},"description":"Optional. Links of attachments to remove."},"calendarId":{"type":"string","description":"Optional. ID of the calendar, an email address that list_calendars can resolve. Default: the primary calendar."},"summary":{"type":"string","description":"Optional. New title."},"description":{"type":"string","description":"Optional. New description. Can contain HTML."},"location":{"type":"string","description":"Optional. New location."},"startTime":{"type":"string","description":"Optional. New start (ISO 8601). When only the start changes, the duration is kept. Pass the local time with no UTC offset and no trailing Z (for example 2026-04-30T10:00:00); include an offset only if the user stated one. If the user named a time zone, put its IANA name in timeZone."},"endTime":{"type":"string","description":"Optional. New end (ISO 8601). Same rules as startTime. For an all-day event the end is exclusive."},"allDay":{"type":"boolean","description":"Optional. Makes the event all-day (true) or timed (false). When set, startTime and endTime are required."},"timeZone":{"type":"string","description":"Optional. IANA time zone name (for example America/Los_Angeles) for the event. Given alone, the event keeps the same moment in time and is shown in this time zone. Set it only when the user states a time zone, and always set it when they do. When unset, the calendar's own time zone is used."},"notificationLevel":{"type":"string","enum":["NOTIFICATION_LEVEL_UNSPECIFIED","NONE","EXTERNAL_ONLY","ALL"],"description":"Optional. Which email notifications to send. NONE: none. EXTERNAL_ONLY: attendees outside the organizer's domain only. ALL: all attendees. Default: ALL."},"addGoogleMeetUrl":{"type":"boolean","description":"Optional. When true, creates a Google Meet link for the event."},"visibility":{"type":"string","enum":["default","public","private"],"description":"Optional. Visibility: default (the calendar's default), public, or private (only attendees see details)."},"colorId":{"type":"string","description":"Optional. Event color ID, \"1\" to \"11\"."},"googleMeetUrl":{"type":"string","description":"Optional. An existing Google Meet link or meeting ID to attach. Overrides addGoogleMeetUrl."},"guestPermissions":{"type":"object","properties":{"guestsCanInviteOthers":{"type":"boolean","description":"Optional. Whether guests can invite others."},"guestsCanModify":{"type":"boolean","description":"Optional. Whether guests can change the event."},"guestsCanSeeGuests":{"type":"boolean","description":"Optional. Whether guests can see the other guests."}},"description":"Optional. Guest permissions."},"availability":{"type":"string","enum":["AVAILABILITY_UNSPECIFIED","AVAILABILITY_BUSY","AVAILABILITY_FREE"Line truncated
"docs__read_doc": {"type":"object","properties":{"documentId":{"type":"string","description":"Required. The ID of the document to read: the part of its docs.google.com link after /d/."},"commentsIncluded":{"type":"boolean","description":"Optional. If true, comment threads are listed at the end of content.text. When your access does not include comments and suggestions, the document is returned without them and content.notes says so. Default: false."}},"required":["documentId"]},
"docs__update_doc": {"type":"object","properties":{"documentId":{"type":"string","description":"Required. The ID of the document to edit."},"requests":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Required. Docs API batchUpdate requests, each an object with exactly one request kind, such as {\"insertText\": {\"text\": \"Hello\", \"location\": {\"index\": 1}}}. See https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request."},"writeControl":{"type":"object","properties":{"requiredRevisionId":{"type":"string","description":"Required. The revisionId from read_doc. If the document is no longer at this revision, nothing is changed."},"targetRevisionId":{"type":"string","description":"Not supported: use requiredRevisionId."},"writeMode":{"type":"string","enum":["WRITE_MODE_UNSPECIFIED","EDIT","SUGGEST"],"description":"Optional. EDIT (default) applies the changes; SUGGEST makes them as suggestions."}},"required":["requiredRevisionId"],"description":"Required. Controls how the edit is applied."}},"required":["documentId","requests","writeControl"]},
"drive__copy_file": {"type":"object","properties":{"fileId":{"type":"string","description":"Required. ID of the file to copy. A Drive file ID, from search_files or list_recent_files."},"title":{"type":"string","description":"Optional. Title of the copy. Default: Google's default copy name."},"parentId":{"type":"string","description":"Optional. ID of the folder for the copy. Default: the original's folder."},"pregeneratedId":{"type":"string","description":"Optional. A Drive-generated ID to give the copy. Not for Google Docs, Sheets or Slides."}},"required":["fileId"]},
"drive__create_file": {"type":"object","properties":{"title":{"type":"string","description":"Required. Title of the new file."},"contentMimeType":{"type":"string","description":"MIME type of the uploaded content; required when content is given. Without content, the Google file type to create."},"textContent":{"type":"string","description":"Optional. UTF-8 text to upload. Do not combine with base64Content."},"base64Content":{"type":"string","description":"Optional. Base64-encoded bytes to upload. Do not combine with textContent."},"content":{"type":"string","description":"Deprecated: use base64Content or textContent. Base64-encoded content."},"mimeType":{"type":"string","description":"Deprecated: use contentMimeType."},"parentId":{"type":"string","description":"Optional. ID of the folder to create the file in. Default: My Drive."},"disableConversionToGoogleType":{"type":"boolean","description":"Optional. Keep the uploaded MIME type instead of converting to a Google Docs, Sheets or Slides file. Default: false."},"inheritedPermissionsDisabled":{"type":"boolean","description":"Optional. For a new folder: do not inherit the parent folder's sharing."},"pregeneratedId":{"type":"string","description":"Optional. A Drive-generated ID to give the new file. Only for folders and files that are not converted (set disableConversionToGoogleType)."}},"required":["title"]},
"drive__download_file_content": {"type":"object","properties":{"fileId":{"type":"string","description":"Required. ID of the file to download. A Drive file ID, from search_files or list_recent_files."},"exportMimeType":{"type":"string","description":"Optional. For Google Docs, Sheets, Slides, Drawings and Apps Script files, the MIME type to export to, one of the formats Google lists for that file type (for example application/pdf or text/markdown for a Doc). Ignored for other files. Default: a text format."},"revisionId":{"type":"string","description":"Optional. ID of an earlier revision of this file to download. Only for files that are not Google Docs, Sheets, Slides or other Google files. Default: the current version."}},"required":["fileId"]},
"drive__get_file_metadata": {"type":"object","properties":{"fileId":{"type":"string","description":"Required. ID of the file. A Drive file ID, from search_files or list_recent_files."},"includeRichMetadata":{"type":"boolean","description":"Optional. When true, also returns ownerName, lastModifyingUserName, lastModifyingUserEmail and visibility. Default: false."},"excludeContentSnippets":{"type":"boolean","description":"Optional. Accepted for compatibility. This implementation never returns content snippets."},"snippetVerbosity":{"type":"string","enum":["UNSPECIFIED","BRIEF","MEDIUM","DETAILED","MAX_ALLOWED"],"description":"Optional. Accepted for compatibility. This implementation never returns content snippets. Must not be set when excludeContentSnippets is true."}},"required":["fileId"]},
"drive__get_file_permissions": {"type":"object","properties":{"fileId":{"type":"string","description":"Required. ID of the file. A Drive file ID, from search_files or list_recent_files."}},"required":["fileId"]},
"drive__list_recent_files": {"type":"object","properties":{"orderBy":{"type":"string","description":"Optional. recency (default), lastModified or lastModifiedByMe."},"pageSize":{"type":"integer","description":"Optional. Files per page. Default 10, at most 100."},"pageToken":{"type":"string","description":"Optional. nextPageToken from the previous page."},"excludeContentSnippets":{"type":"boolean","description":"Optional. Accepted for compatibility. This implementation never returns content snippets."},"snippetVerbosity":{"type":"string","enum":["UNSPECIFIED","BRIEF","MEDIUM","DETAILED","MAX_ALLOWED"],"description":"Optional. Accepted for compatibility. This implementation never returns content snippets. Must not be set when excludeContentSnippets is true."}}},
"drive__read_file_content": {"type":"object","properties":{"fileId":{"type":"string","description":"Required. ID of the file to read. A Drive file ID, from search_files or list_recent_files."},"includeComments":{"type":"boolean","description":"Optional. Also return the file's comment threads (Google Docs, Sheets and Slides only). Default: false."}},"required":["fileId"]},
"drive__search_files": {"type":"object","properties":{"query":{"type":"string","description":"Optional. Structured query: term operator value. Combine clauses with and, or, not and parentheses. Quote string values with single quotes; write a quote inside a value as \\' and a backslash as \\\\. Terms: title (contains, =, !=; title contains is a prefix match: 'Hello' finds HelloWorld, 'World' does not); fullText (contains; title or body text); mimeType (contains, =, !=); modifiedTime, viewedByMeTime, createdTime (<, <=, =, !=, >, >=, with an RFC 3339 time such as '2026-01-01T00:00:00Z'); parentId (=, !=; 'root' is My Drive); owner (=, !=; 'me' is the user); 'someone@example.com' in readers, 'me' in writers; visibility (=, !=: 'anyoneCanFind', 'anyoneWithLink', 'anyone', 'domainCanFind', 'domainWithLink', 'domain', 'limited'); sharedWithMe, starred, trashed (=, != with true or false). Trashed files are left out unless the query uses trashed. Not supported here: creator, sharedFrom, sharedTo, followUp, folderProperties, and visibility 'external'. Use title contains rather than title = unless the user asks for an exact title; to find a word inside a title, also try fullText contains. Put file types in mimeType clauses, not in title or fullText (for example mimeType = 'application/vnd.google-apps.presentation' for slides). Examples: title contains 'budget' and modifiedTime > '2026-01-01T00:00:00Z'; parentId = 'root'; owner = 'me' and starred = true. Empty: all files that are not trashed."},"pageSize":{"type":"integer","description":"Optional. Files per page. Default 10, at most 100."},"pageToken":{"type":"string","description":"Optional. nextPageToken from the previous page."},"orderBy":{"type":"string","description":"Optional. modifiedTime or viewedByMeTime, optionally followed by asc or desc (default desc). Default: Drive's own order."},"includeRichMetadata":{"type":"boolean","description":"Optional. When true, also returns ownerName, lastModifyingUserName, lastModifyingUserEmail and visibility. Default: false."},"excludeContentSnippets":{"type":"boolean","description":"Optional. Accepted for compatibility. This implementation never returns content snippets."},"snippetVerbosity":{"type":"string","enum":["UNSPECIFIED","BRIEF","MEDIUM","DETAILED","MAX_ALLOWED"],"description":"Optional. Accepted for compatibility. This implementation never returns content snippets. Must not be set when excludeContentSnippets is true."}}},
"gmail__create_draft": {"type":"object","properties":{"to":{"type":"array","items":{"type":"string"},"description":"Optional. To recipients, each a plain email address such as user@example.com. \"Name <email>\" is not supported."},"cc":{"type":"array","items":{"type":"string"},"description":"Optional. Cc recipients, each a plain email address."},"bcc":{"type":"array","items":{"type":"string"},"description":"Optional. Bcc recipients, each a plain email address."},"subject":{"type":"string","description":"Optional. The subject line. Empty when not given."},"body":{"type":"string","description":"Optional. The plain-text body. When htmlBody is also given, this is the plain-text alternative."},"htmlBody":{"type":"string","description":"The HTML body, used as the rich-text version."},"replyToMessageId":{"type":"string","description":"Optional. The ID of the message this draft replies to."},"attachments":{"type":"array","description":"Optional. Attachments, at most 25 MB in total. Not supported yet.","items":{"type":"object","properties":{"id":{"type":"string","description":"Output only. An external attachment ID."},"filename":{"type":"string","description":"Optional. The file name shown to recipients."},"mimeType":{"type":"string","description":"Optional. IANA media type. Default application/octet-stream."},"content":{"type":"string","description":"Required. The base64-encoded content."},"inline":{"type":"boolean","description":"Optional. Show inline in the HTML body. Default false."}},"required":["content"]}}}},
"gmail__get_draft": {"type":"object","properties":{"draftId":{"type":"string","description":"Required. The ID of the draft to get."},"view":{"type":"string","enum":["DRAFT_VIEW_UNSPECIFIED","DRAFT_VIEW_METADATA_ONLY","DRAFT_VIEW_FULL"],"description":"Optional. DRAFT_VIEW_FULL (default) returns recipients, subject and bodies. DRAFT_VIEW_METADATA_ONLY leaves out the subject and bodies."}},"required":["draftId"]},
"gmail__get_message": {"type":"object","properties":{"messageId":{"type":"string","description":"Required. The ID of the message to get."},"messageFormat":{"type":"string","enum":["MESSAGE_FORMAT_UNSPECIFIED","MINIMAL","FULL_CONTENT","METADATA_ONLY"],"description":"Optional. How much of the message to return. MINIMAL: snippet and the Subject, From, To, Cc and Date headers. FULL_CONTENT (default): MINIMAL plus the body and attachments. METADATA_ONLY: no subject, snippet, body or attachment names."}},"required":["messageId"]},
"gmail__get_thread": {"type":"object","properties":{"threadId":{"type":"string","description":"Required. The ID of the thread to get."},"messageFormat":{"type":"string","enum":["MESSAGE_FORMAT_UNSPECIFIED","MINIMAL","FULL_CONTENT","METADATA_ONLY"],"description":"Optional. How much of each message to return. MINIMAL: snippet and the Subject, From, To, Cc and Date headers. FULL_CONTENT (default): MINIMAL plus the bodies and attachments. METADATA_ONLY: no subject, snippet, body or attachment names."}},"required":["threadId"]},
"gmail__list_drafts": {"type":"object","properties":{"pageSize":{"type":"integer","description":"Optional. Most drafts to return. Default 20, maximum 50."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from a previous call. Leave empty for the first page."},"query":{"type":"string","description":"Optional. A Gmail search query (for example `to:user@example.com newer_than:7d`)."},"view":{"type":"string","enum":["DRAFT_VIEW_UNSPECIFIED","DRAFT_VIEW_METADATA_ONLY","DRAFT_VIEW_FULL"],"description":"Optional. DRAFT_VIEW_FULL (default) returns recipients, subject and bodies. DRAFT_VIEW_METADATA_ONLY leaves out the subject and bodies."}}},
"gmail__list_labels": {"type":"object","properties":{"pageSize":{"type":"integer","description":"Optional. Most labels to return. Default 100, maximum 500."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from a previous call. Leave empty for the first page."}}},
"gmail__list_threads": {"type":"object","properties":{"pageSize":{"type":"integer","description":"Optional. Most threads to return. Default 20, maximum 50."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from a previous call. Leave empty for the first page."},"labelIds":{"type":"array","items":{"type":"string"},"description":"Optional. Only threads with all of these label IDs, at most 20. User label IDs come from list_labels; system label IDs are INBOX, SPAM, TRASH, UNREAD, STARRED, IMPORTANT, SENT, DRAFT and CHAT. Drafts are excluded unless DRAFT is given."},"includeTrash":{"type":"boolean","description":"Optional. Include threads in Trash. Default false."},"view":{"type":"string","enum":["THREAD_VIEW_UNSPECIFIED","THREAD_VIEW_MINIMAL","THREAD_VIEW_METADATA_ONLY"],"description":"Optional. THREAD_VIEW_MINIMAL (default) returns id, snippet, subject, sender, recipients, date and labels. THREAD_VIEW_METADATA_ONLY leaves out snippet and subject."}}},
"gmail__search_messages": {"type":"object","properties":{"pageSize":{"type":"integer","description":"Optional. Most messages to return. Default 20, maximum 50."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from a previous call. Leave empty for the first page."},"query":{"type":"string","description":"Optional. A Gmail search query (for example `from:user@example.com newer_than:7d has:attachment`). Convert natural language to Gmail syntax first. `label:` takes a label name with spaces written as hyphens (for example `label:client-work`), not a label ID; list_labels lists the names. Without a query, all messages except spam and trash are listed. Drafts are excluded unless the query includes in:draft."},"includeTrash":{"type":"boolean","description":"Optional. Include messages in Trash. Default false."},"messageFormat":{"type":"string","enum":["MESSAGE_FORMAT_UNSPECIFIED","MINIMAL","FULL_CONTENT","METADATA_ONLY"],"description":"Optional. How much of each message to return. MINIMAL (default): snippet and the Subject, From, To, Cc and Date headers. FULL_CONTENT: MINIMAL plus the bodies and attachments. METADATA_ONLY: no subject, snippet, body or attachment names."}}},
"gmail__search_threads": {"type":"object","properties":{"pageSize":{"type":"integer","description":"Optional. Most threads to return. Default 20, maximum 50."},"pageToken":{"type":"string","description":"Optional. The nextPageToken from a previous call. Leave empty for the first page."},"query":{"type":"string","description":"Optional. A Gmail search query (for example `from:user@example.com newer_than:7d has:attachment`). Convert natural language to Gmail syntax first. `label:` takes a label name with spaces written as hyphens (for example `label:client-work`), not a label ID; list_labels lists the names. Without a query, all threads except spam and trash are listed. Drafts are excluded unless the query includes in:draft."},"includeTrash":{"type":"boolean","description":"Optional. Include threads in Trash. Default false."},"view":{"type":"string","enum":["THREAD_VIEW_UNSPECIFIED","THREAD_VIEW_MINIMAL","THREAD_VIEW_METADATA_ONLY"],"description":"Optional. THREAD_VIEW_MINIMAL (default) returns id, snippet, subject, sender, recipients, date and labels. THREAD_VIEW_METADATA_ONLY leaves out snippet and subject."}}},
"sheets__get_spreadsheet": {"type":"object","properties":{"spreadsheetId":{"type":"string","description":"Required. The ID of the spreadsheet, the part of its URL after /d/."},"includeGridData":{"type":"boolean","description":"Optional. True to return cell data. Ignored when fields is set. Default: false."},"fields":{"type":"array","items":{"type":"string"},"description":"Optional. Field masks naming the parts of the Spreadsheet resource to return, as paths in its JSON, for example sheets.properties.sheetId and sheets.properties.title, or grouped as sheets.properties(sheetId,title). Default: everything except cell data."},"ranges":{"type":"array","items":{"type":"string"},"description":"Optional. The ranges to return, each in A1 notation (Sheet1!A1:C10, Sheet1!A:C, Sheet1!2:5) or R1C1 notation (Sheet1!R1C1:R10C3). Without a sheet name the first sheet is used. Put a sheet name with spaces or punctuation in single quotes and double any apostrophe: 'Q1 Plan'!A1:B2, 'Bob''s list'!A:A. Default: the whole spreadsheet."},"commentsIncluded":{"type":"boolean","description":"Optional. Not supported here: true is refused. Default: false."}},"required":["spreadsheetId"]},
"sheets__get_values": {"type":"object","properties":{"spreadsheetId":{"type":"string","description":"Required. The ID of the spreadsheet, the part of its URL after /d/."},"range":{"type":"string","description":"Required. The range to read, in A1 notation (Sheet1!A1:C10, Sheet1!A:C, Sheet1!2:5) or R1C1 notation (Sheet1!R1C1:R10C3). Without a sheet name the first sheet is used. Put a sheet name with spaces or punctuation in single quotes and double any apostrophe: 'Q1 Plan'!A1:B2, 'Bob''s list'!A:A."}},"required":["spreadsheetId","range"]},
"sheets__insert_dimension": {"type":"object","properties":{"spreadsheetId":{"type":"string","description":"Required. The ID of the spreadsheet, the part of its URL after /d/."},"sheetId":{"type":"integer","description":"Required. The ID of the sheet to insert into (sheets.properties.sheetId from get_spreadsheet; the first sheet is often 0)."},"dimension":{"type":"string","enum":["DIMENSION_UNSPECIFIED","COLUMNS","ROWS"],"description":"Required. ROWS or COLUMNS. DIMENSION_UNSPECIFIED is refused."},"startIndex":{"type":"integer","description":"Required. The 0-based start index of the insertion (inclusive). Row 1 is index 0; column A is index 0."},"endIndex":{"type":"integer","description":"Required. The 0-based end index of the insertion (exclusive). endIndex minus startIndex rows or columns are inserted."},"inheritFromBefore":{"type":"boolean","description":"Optional. True to copy formatting and size from the row or column before the insertion (startIndex must then be greater than 0); false to copy from the one after. Default: false."}},"required":["spreadsheetId","sheetId","dimension","startIndex","endIndex"]},
"sheets__update_formulas": {"type":"object","properties":{"spreadsheetId":{"type":"string","description":"Required. The ID of the spreadsheet, the part of its URL after /d/."},"range":{"type":"string","description":"Required. The range to write, in A1 notation (Sheet1!A1:C10, Sheet1!A:C, Sheet1!2:5) or R1C1 notation (Sheet1!R1C1:R10C3). Without a sheet name the first sheet is used. Put a sheet name with spaces or punctuation in single quotes and double any apostrophe: 'Q1 Plan'!A1:B2, 'Bob''s list'!A:A. Formulas fill it from the top-left cell."},"formulas":{"type":"array","items":{"type":"array","items":{}},"description":"Required. The formulas, one array per row, one item per cell, for example [[\"=A1+B1\"], [\"=A2+B2\"]]. Items may also be numbers, booleans or null. null skips the cell; an empty string clears it."}},"required":["spreadsheetId","range","formulas"]},
"sheets__update_spreadsheet": {"type":"object","properties":{"spreadsheetId":{"type":"string","description":"Required. The ID of the spreadsheet, the part of its URL after /d/."},"requests":{"type":"array","items":{"type":"object","additionalProperties":{"description":"Properties of the object."}},"description":"Required. The updates, each a Sheets API Request object with exactly one operation (https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets/request). Applied in order; if any is invalid, none is applied. Ranges use 0-based sheetId, row and column indexes, with end indexes exclusive."},"writeControl":{"type":"object","properties":{"requiredRevisionId":{"type":"string","description":"Not supported here."}},"description":"Optional. Not supported here: any value is refused."}},"required":["spreadsheetId","requests"]},
"sheets__update_values": {"type":"object","properties":{"spreadsheetId":{"type":"string","description":"Required. The ID of the spreadsheet, the part of its URL after /d/."},"range":{"type":"string","description":"Required. The range to write, in A1 notation (Sheet1!A1:C10, Sheet1!A:C, Sheet1!2:5) or R1C1 notation (Sheet1!R1C1:R10C3). Without a sheet name the first sheet is used. Put a sheet name with spaces or punctuation in single quotes and double any apostrophe: 'Q1 Plan'!A1:B2, 'Bob''s list'!A:A. Values fill it from the top-left cell."},"values":{"type":"array","items":{"type":"array","items":{}},"description":"Required. The values, one array per row, one item per cell. Each item is a string, number, boolean or null. null skips the cell; an empty string clears it."}},"required":["spreadsheetId","range","values"]},
"slides__read_presentation": {"type":"object","properties":{"presentationId":{"type":"string","description":"Required. The ID of the presentation to read: the part of its docs.google.com link after /d/."},"fields":{"type":"array","items":{"type":"string"},"description":"Optional. A field mask over the Slides API presentation resource, such as [\"revisionId\", \"slides(objectId,pageElements(objectId,shape.text))\"]. When set, content is the raw resource limited to these fields instead of the text form."},"commentsIncluded":{"type":"boolean","description":"Optional. If true, comment threads are included. Needs access to comments; without it the call fails and says so. Default: false."}},"required":["presentationId"]},
"slides__update_presentation": {"type":"object","properties":{"presentationId":{"type":"string","description":"Required. The ID of the presentation to edit."},"requests":{"type":"array","items":{"type":"object","additionalProperties":true},"description":"Required. Slides API batchUpdate requests, each an object with exactly one request kind, such as {\"insertText\": {\"objectId\": \"shape-1\", \"text\": \"Hello\", \"insertionIndex\": 0}}. See https://developers.google.com/workspace/slides/api/reference/rest/v1/presentations/request."},"writeControl":{"type":"object","properties":{"requiredRevisionId":{"type":"string","description":"Required. The revisionId from read_presentation. If the presentation is no longer at this revision, nothing is changed."}},"required":["requiredRevisionId"],"description":"Required. Controls how the edit is applied."}},"required":["presentationId","requests","writeControl"]}
}
@@ -20,3 +20,4 @@ export {
type GoogleCalendarEventRead,
type GoogleWorkspaceArgumentCheck,
} from "./argument-guards.js";
export { GOOGLE_WORKSPACE_REST_SHIPPED_SCHEMA_HASHES } from "./shipped-schema-hashes.js";
@@ -0,0 +1,146 @@
export const GOOGLE_WORKSPACE_REST_SHIPPED_SCHEMA_HASHES: Readonly<Record<string, readonly string[]>> = {
calendar__create_event: [
"9ef6771ab1260bc12935c10d3fe7df2ab8ed2ab4ae16d81e83b40ae874d8ff65",
"4fa4f8cf770618b595f0352ae2907e33b1e68c888264b6a5d8bf7ad979857bc1",
],
calendar__delete_event: [
"7706102385e8fd7c82252d73551482392bfec7ca2ed471f8290fd525da614f9a",
"be4ffeb17ea89b31ffd3feb3d9f0caabdbf7a045ad84d588a93e7f373f077f02",
],
calendar__get_event: [
"c1e7254c82a0459bb51d895453dd54c98c4e95692c24c3b2cc3a678956f4dc4a",
"ca8ff2d66d24d8525f44821bc9fced95db136bf1d76a15165d0f4c7fdb4dba08",
],
calendar__list_calendars: [
"4aec38e23f556602006f0beef2b422ce4c3725d55871097da26262f0eb12d901",
"986cab6c31c00ccca8cd6be448d9486317531b04d9b537b1d3f31b4e323ccacc",
],
calendar__list_events: [
"0615cdffd879d69e638048f845a8f4b235b0280ea3ae608c0a79b8f329b7e995",
"01eaff14f6d0e9279c4b534177e4488756d4d662122c2507c03951242f07dda2",
],
calendar__respond_to_event: [
"eab5f958ce836f82a9a162b42e844b908a425e8c57b76e47cb260cd7bd4d5944",
"7e8993a66735ef154c7f0ec4d5e478c8f4724f43bec0618d500b374d080c9686",
],
calendar__search_events: [
"b8a2996b48489de4c1d5eeec95171ee0ff3e0515afb4c9a32960524199846536",
"2bce27e2fea16a9e04e3a0e4b23d0bca9007e6121b9bb9a791a7c28884e32fd0",
],
calendar__suggest_time: [
"102fc41326b15790ab87cf16ed94fce172fe8abc39bb46c09b0c39690d5abd1f",
"9c5b7e966755ce8e530c0b206440ae6368d288c27cf02ab6f1a788971b56443d",
],
calendar__update_event: [
"eec50b5d64030861b31ddc264e7fdca7f32199496ad5ee92b47acd514c75c2e0",
"6a6ce4bacb0eaf216bc23db00da57c9bd35a7c2b7ad38217ba50c3ebc8851f0b",
],
docs__read_doc: [
"e329efa85d85394d5a56a52fa142ecd2a310763bf464bde3c043d344acf78d5b",
"61943cd4a2851102ee9828422d66cba9d77fcf6085272ff650d2081d34c84fdf",
],
docs__update_doc: [
"61d93006bec2147260c083b217b418c530fc4bb6bdc20f42229ef9e16ac5becd",
"dd4a504dea5fcb6b0ab19844ca3960341adf6544727ee1cd6912b467c96a8e8f",
],
drive__copy_file: [
"5b87b1ad649b7e732abc87e5ef9d99a1aa619266c894d6b498cdf7351e5825de",
"1cac1e9aeac8597f09a3bc08c87610c24c56b317812cfc8ebb37a779c9c7ea0f",
],
drive__create_file: [
"f9b5e57ec84c1fd880cbe773434cfa72a91e9e93de6703680b5369c760fe505f",
"4c51a98e9230c41ffb78c95353c19892475cf6be4a88587de32fe5460ee87e14",
],
drive__download_file_content: [
"959cd1b8a8920da32a3dc4f05d0d4a79e84729729ded7523fd511e9726456a6b",
"b6b85047a6dede07725f881ae38dd99490fe09c4ad753e498b52d47029a15823",
],
drive__get_file_metadata: [
"b622dd99fba02b655389855321ea5efee2ce0860e31a95c524ee7e0cd87b436b",
"d8550ad38dddac1d50b7a52de57863d1a51d5ca6e047d88286579cf69a970920",
],
drive__get_file_permissions: [
"0dfbd05b9ea0e5d3b663d97ed1027098e2f183020f81acf81861825b6908a77c",
"382a16f10f145399fcd590c63f27b44fd14f2a78181970d5be27ebf663ebaa45",
],
drive__list_recent_files: [
"d97f3916d8cf9a8188da553140acc66b7a036dbcadda14cb8351d007522f31d6",
"6f3123377bdb1d4435afa7599a7f563709f4eaf12fed6581b192cdf4f64d3627",
],
drive__read_file_content: [
"a03bb4e98f403a3a7199fba2400fb66a38148ce581c98e236227a72823ac22ca",
"336a4df3d2fe5ac24f94afdff80c18f80067d1d4572015218cde5f791ec7b5c1",
],
drive__search_files: [
"2f5de7da08fb15253d8c7080564ea5bb0e2418ad2f0b79dfec895055c235afe1",
"a306710408bcd630ddc73ec77bdf054e518ff3264fe0eb0f9e1b63b6173f82f5",
],
gmail__create_draft: [
"e9cf0e371be7cec4b2d7c6cfd09b0d9f78bb60d205129cc5d780f11b2a169311",
"c37dc870ccc33e14b2a7a94f5d0fc4470e892f42ea724e14e5c48dffea7fbc98",
],
gmail__get_draft: [
"67252aaf006bb9f2e17d9c2f7b54bf3a9bd2820a2bb0aef58e3cd52290229408",
"80b1495e156bac6239619a900c6db7fa63a6da89d1faeb0ecfbfdb79ca1779c1",
],
gmail__get_message: [
"b8cf36f248f7f68173b4f9ffe96b01175cfafce669b0ffe7e4ad0e05699a93a0",
"015e4f2d740469a5e938a74e68ac85bff2adef9332c5c0cce4e3190a249eedca",
],
gmail__get_thread: [
"ed258d66133c23b77a74022848d969ed60bf22994ec548f3427d6e08550047bb",
"00222d28e25f7603b076124fba214d89d4dad9e4b37f6e3c434d9c359ecb8908",
],
gmail__list_drafts: [
"d6becdc4a640ddc55b12e78ffccad868072b142ca5bf69956b7150dee52063bb",
"2f7231aff6f4fc33a8abbb59d110a4859421d3cd0d0c992ba2768b2074adb337",
],
gmail__list_labels: [
"a5e8cefcbf70a20e56ba72428b5cd51339784afb13f71c7cd35aa6086a27bc02",
"d4f4d534fd4dd7680884f81daf7c9810e6774b682fd7fb9cc1f1b569566048bb",
],
gmail__list_threads: [
"3fc29f7b2c4b4c8f511e8df64877b1859ec0f3d1446d94f7377b3b67c44820eb",
"fe26518baec92006613b9f4bcd9fd86bcf37ea0d5731871167e3a009187767f7",
],
gmail__search_messages: [
"e54d4f1fd4404e8aafc9dfb5b90cd0aa1cea11373b36111c0dd6a26dfc914bb6",
"3ad7db93b184de7ace06242c1422b3d563327e299669498527f0636cae7a0045",
],
gmail__search_threads: [
"d79c37bc4564d07da8ce46da850ad27f35b2a4ddd6414e580882237cf4e806cd",
"3a89bd47a9fc389eccc142511425212cf121c0c835d7ab068d471e302c699ba1",
],
sheets__get_spreadsheet: [
"74c759fe649b35d57c6fbc86dfedd5661987a83e200819c136c9ba38b14e7b12",
"2eb433858006c0a629d35f0a5138198da0d30d8fee9436cd13b84fceee922dcf",
],
sheets__get_values: [
"1ee6a7c98c007dcbdb440f07747c006f00102e7a73b8682d448e29e4588007b1",
"7457597934598bb756a5bd079385d26be4e65dec0d091fc394e1cc0365bde7d4",
],
sheets__insert_dimension: [
"5f2a808a73e53959f319ec223e5417dc29f00ad52f7b273e063ae12ded3262f2",
"a7d5f5497e02e547aa1cc4b0c53b8a83efba3e6474b3eaf3b4a8a4a22da4e6da",
],
sheets__update_formulas: [
"85f165bee6d362201ae173dd345ba1de80007e82238aad51cbdbafecd68aa9bf",
"a9986fd404bc881bea185b7b53098ef67a898f0265aa4c6a327c31ca0a067676",
],
sheets__update_spreadsheet: [
"a8bc519d87ce43187813bd2c901eba88a3ea936c13df0f14af719a3cc0a7ac17",
"9ccf48dd2106b64fcf0cc38c40d198c0a3eb48b1b5f64e6700258c6f2f7e10ca",
],
sheets__update_values: [
"cb1ed8ba97689e17ccf03e1bc273a7e8e5eb25fcafb459890272c99b13cb426e",
"9c0994d810dbceb88ec05f09d105ea8df7e26917bcd16778a905f6112031411e",
],
slides__read_presentation: [
"c5025ee76a03e5bfa8853657310e987af54a49214addf00a1b088bf6906dc78e",
"5a6b62981645837e96c0621d24ce0f6dc667b3b1919f4169548217354f5cff31",
],
slides__update_presentation: [
"c95666bf9a12aae06b2105f2ae1d24def87e6a6c2e2a2832beb4049deb54809b",
"6585cfb4474f7544fbd5cdb3ab174580f9bbc0bf4d08465d9f484fa6e1b439f5",
],
};
@@ -1,4 +1,4 @@
import { googleWorkspaceRestFallbackDefinition, googleWorkspaceRestToolDefinition } from "../google-workspace-rest-dispatch.js";
import { googleWorkspaceRestShippedSchemaHashes, googleWorkspaceRestToolDefinition } from "../google-workspace-rest-dispatch.js";
import type { toolConnections } from "@paperclipai/db";
import { pluginConnectionMethod, pluginConnectionToolDefinition } from "../plugin-connector-runtime.js";
import { shouldQuarantineNewEntries } from "../tool-access/catalog/descriptors.js";
@@ -17,12 +17,12 @@ type Connection = { config: Record<string, unknown> };
const PAPERCLIP_DEFINED_TOOL_SOURCES: ReadonlyArray<{
matches: (connection: Connection) => boolean;
definition: (toolName: string) => PaperclipDefinedToolDefinition | null;
formerDefinition: (toolName: string) => PaperclipDefinedToolDefinition | null;
shippedSchemaHashes: (toolName: string) => readonly string[];
}> = [
{
matches: (connection) => connection.config.sourceTemplateKey === "google-workspace",
definition: googleWorkspaceRestToolDefinition,
formerDefinition: googleWorkspaceRestFallbackDefinition,
shippedSchemaHashes: googleWorkspaceRestShippedSchemaHashes,
},
];
@@ -30,8 +30,8 @@ export function paperclipDefinedTool(connection: Connection, toolName: string):
return PAPERCLIP_DEFINED_TOOL_SOURCES.find((source) => source.matches(connection))?.definition(toolName) ?? null;
}
export function formerPaperclipDefinedTool(connection: Connection, toolName: string): PaperclipDefinedToolDefinition | null {
return PAPERCLIP_DEFINED_TOOL_SOURCES.find((source) => source.matches(connection))?.formerDefinition(toolName) ?? null;
export function shippedPaperclipSchemaHashes(connection: Connection, toolName: string): readonly string[] {
return PAPERCLIP_DEFINED_TOOL_SOURCES.find((source) => source.matches(connection))?.shippedSchemaHashes(toolName) ?? [];
}
export function currentConnectionToolDefinition(connection: typeof toolConnections.$inferSelect, toolName: string): PaperclipDefinedToolDefinition | null {
@@ -1,7 +1,10 @@
import { GOOGLE_WORKSPACE_TOOL_TRANSPORT, googleWorkspaceServiceToolNames } from "@paperclipai/shared";
import { readFileSync } from "node:fs";
import { describe, expect, it, onTestFinished, vi } from "vitest";
import { stableHash } from "./tool-catalog-hash.js";
import {
callGoogleWorkspaceRest,
googleWorkspaceRestShippedSchemaHashes,
googleWorkspaceRestToolDefinition,
googleWorkspaceCatalogToolTitle,
googleWorkspaceMcpPreflightRefusal,
@@ -50,6 +53,33 @@ describe("googleWorkspaceRestToolDefinition", () => {
});
});
describe("googleWorkspaceRestShippedSchemaHashes", () => {
const services = ["gmail", "calendar", "drive", "docs", "slides", "sheets"] as const;
const schemas22634: Record<string, Record<string, unknown>> = JSON.parse(
readFileSync(new URL("../google-workspace-rest-tools/fixtures/input-schemas-22634.json", import.meta.url), "utf8"));
it("lists the input schema of every REST tool as it ships now, so a saved row from this build is recognised after a switch", () => {
for (const service of services) {
for (const tool of listGoogleWorkspaceRest(service)) {
expect(googleWorkspaceRestShippedSchemaHashes(`${service}__${tool.name}`), `${service}__${tool.name}`).toContain(stableHash(tool.inputSchema));
}
}
});
it("lists the input schemas the first REST launch (#22634) saved", () => {
expect(Object.keys(schemas22634)).toHaveLength(36);
for (const [name, schema] of Object.entries(schemas22634)) {
expect(googleWorkspaceRestShippedSchemaHashes(name), name).toContain(stableHash(schema));
}
});
it("lists nothing for a tool with no REST definition", () => {
expect(googleWorkspaceRestShippedSchemaHashes("chat__list_messages")).toEqual([]);
expect(googleWorkspaceRestShippedSchemaHashes("gmail__send_message")).toEqual([]);
expect(googleWorkspaceRestShippedSchemaHashes("update_doc")).toEqual([]);
});
});
describe("googleWorkspaceCatalogToolTitle", () => {
const UUID = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i;
@@ -9,6 +9,7 @@ import {
type GoogleWorkspaceToolTransport,
} from "@paperclipai/shared";
import {
GOOGLE_WORKSPACE_REST_SHIPPED_SCHEMA_HASHES,
GoogleWorkspaceAuthError,
callGoogleWorkspaceRestTool,
googleCalendarSeriesRefusal,
@@ -73,6 +74,11 @@ export function googleWorkspaceRestFallbackDefinition(toolName: string): GoogleW
} : null;
}
export function googleWorkspaceRestShippedSchemaHashes(toolName: string): readonly string[] {
const target = googleWorkspaceToolTarget(toolName);
return target ? GOOGLE_WORKSPACE_REST_SHIPPED_SCHEMA_HASHES[`${target.service}__${target.leaf}`] ?? [] : [];
}
function googleWorkspaceTransport(toolName: string): GoogleWorkspaceToolTransport | null {
return googleWorkspaceToolTarget(toolName)?.transport ?? null;
}
@@ -12,7 +12,7 @@ import { connectionMethodForConnection } from "../connection-methods.js";
import { stableHash, descriptorHash } from "../../tool-catalog-hash.js";
import { nativeProviderCatalogFor } from "../../native-provider-catalogs.js";
import { restConnectorFor } from "../../connectors/rest-registry.js";
import { formerPaperclipDefinedTool, paperclipDefinedTool } from "../../connectors/paperclip-defined-tools.js";
import { paperclipDefinedTool, shippedPaperclipSchemaHashes } from "../../connectors/paperclip-defined-tools.js";
import { googleWorkspaceToolTarget, googleWorkspaceGrantedScopes, isGoogleWorkspaceToolGranted } from "@paperclipai/shared";
import { retainMcpConnectionFailure } from "../../mcp-connection-failure.js";
import { isRemoteMcpConnectorMethod } from "@paperclipai/shared";
@@ -238,8 +238,8 @@ export function createToolCatalogPublication(db: Db, { now, audit, getConnection
(existing.versionHash !== hash || existing.schemaHash !== schemaHash);
const paperclipDefined = paperclipDefinedTool(connection, descriptor.name) !== null;
if (paperclipDefined && existing?.status === "quarantined") releasedNames.add(descriptor.name);
const former = !paperclipDefined && existing ? formerPaperclipDefinedTool(connection, descriptor.name) : null;
const leavingPaperclipDefinition = Boolean(former && existing && stableHash(former.inputSchema) === existing.schemaHash);
const leavingPaperclipDefinition = Boolean(!paperclipDefined && existing?.schemaHash
&& shippedPaperclipSchemaHashes(connection, descriptor.name).includes(existing.schemaHash));
const shouldQuarantine =
quarantineOnRefresh &&
!paperclipDefined &&