Expand description
The Google connectors’ agent routes (docs/specs/SPEC_GOOGLE_CONNECTORS_GMAIL_CALENDAR_DRIVE_2026_10_14.md D3, D4):
GET /api/v1/google/self/services: the services the calling agent has a grant on, so its MCP lists only those tools.POST /api/v1/google/calendar: oneCalendaraction.POST /api/v1/google/drive: oneDriveaction (pick_filesopens Google’s file picker for the person).POST /api/v1/google/gmail: oneGmailaction.
Both need an attributed caller (the agent’s own X-Agent-Token): a grant
belongs to an agent, so a request that names none has none.
Modules§
- connect 🔒
Googleconnect,connect_statusandcancel: an agent connects a Google account itself (docs/specs/SPEC_GOOGLE_PHASE_B_AGENTMUXS_OWN_CLIENT_2026_11_01.md §7, §9, D3). It runs the same flow as the Accounts panel’s Connect (oauth_client::start), so the two can’t drift, except that the consent page is not opened in the system browser: the agent opens it in a Browser pane it drives (the account picker, the unverified-app screen, the scope boxes), and stops for the person only at a password, a second factor or an administrator’s block.
Structs§
- Calendar
Body 🔒 - Disconnect
Body 🔒 - Drive
Body 🔒 - Gmail
Body 🔒 - Grant
Body 🔒 - Host
Approver 🔒 - Tells the person in the agent’s own pane that it is about to act, with a countdown that goes ahead
on its own (
agent_notice): they can stop it, hurry it, or say “Always” for this agent. With no pane for the agent there is nowhere to tell them and nothing is done.
Constants§
- BUILT_
SERVICES 🔒 - The services a grant can be set on today; the rest come with their stage.
- PANEL_
CALLS 🔒 - How many log lines the account panel shows.
- PICK_
GAP 🔒 - The least time between two pickers opened for one account by agents, so a loop of
pick_filescalls can’t fill the person’s browser with tabs. - SERVICES 🔒
Functions§
- account_
panel 🔒 - calling_
agent 🔒 - The calling agent’s definition, or why there is none (answered 403).
- disconnect_
by_ 🔒agent - error 🔒
- google_
accounts 🔒 - Every Google account on this computer, by email.
- grant_
as 🔒 - A grant, recorded under
by_name(by_id). With noagentin the body it goes toyourself, which a caller from another machine has none of: it names the agent here. - grant_
by_ 🔒agent - grant_
is_ 🔒backed - Whether a token supporting
supported(write,readornone) can back a grant atlevel. - grant_
notice 🔒 - “Naki-2 gave Agent5 Calendar read on me@example.com”, or “Naki-2 turned off Calendar for Agent5 on …”.
- handle_
google_ 🔒calendar POST /api/v1/google/calendar:{ account, result }, or{ error }with a sentence the agent can act on.- handle_
google_ 🔒disconnect POST /api/v1/google/disconnect: end the connection to a Google account: Google’s grant is revoked first, then the saved token, the account’s grants and its log go. The same code as the window’s delete. Any agent may ask (the person only signs in); it is noticed in the windows.- handle_
google_ 🔒drive POST /api/v1/google/drive:{ account, result }, or{ error }with a sentence the agent can act on.- handle_
google_ 🔒gmail POST /api/v1/google/gmail:{ account, result }, or{ error }with a sentence the agent can act on.- handle_
google_ 🔒grant POST /api/v1/google/grant: turn a service of a connected Google account on for an agent, or off. Any agent may do it (decided: “yes, agents can grant”); it is recorded as the agent that did it, in the account’s log the person reads. Sends, shares, invites and deletes still wait for the person in the host window, which no agent can answer.- handle_
google_ 🔒self_ services GET /api/v1/google/self/services:{ account, accounts, services: [{ service, level, account }] }for the Google accounts the calling agent holds a grant on (accountis the first); none when it has none.- handle_
google_ 🔒status GET /api/v1/google/status: the Google accounts connected here, what each can be used for and who holds what, so an agent knows what to grant or to ask the person for.- handle_
host_ 🔒google POST /api/v1/host/google: the account panel’s operations, from the host only. (Agents turn services on and off throughPOST /api/v1/google/grant.)- last_
picks 🔒 - pick_
files 🔒 pick_files: open Google’s file picker in the person’s browser. The agent gets no ids back: it searches once the person has picked.- pick_
for_ 🔒person - pick_
release 🔒 - A picker that failed to open doesn’t count against the account.
- pick_
throttle 🔒 - Take the account’s picker slot, or say it was taken a moment ago. The slot is held
from the check, so two calls at once can’t both open a picker;
pick_releasegives it back when the picker didn’t open. - set_
grant 🔒 - set_
grant_ 🔒on_ email - Set an agent’s grant on
chosen, one of the connections of an email (same_email, all of them). The agent names an email, so one grant per email: the service is cleared on the email’s other connections, or an ungrant (or a change of level) would leave an older grant usable. - start_
picker_ 🔒for - Start the picker for
accountwith the client it was made with; the session id is polled withaccount.oauth.poll. - status_
for 🔒 - The accounts, what each supports and who holds what.
vieweris the agent asking, whose own level is added asyours; a caller from another machine has no agent here and gets the holders alone. - supported_
level 🔒 - The highest level the account’s token supports for
service, from the scopes it was granted:write,readornone.