Add Gmail account
gmail_add_accountAuthenticate a Gmail account through a browser OAuth flow, selecting access level (readonly, modify, or send), an optional alias, and whether it becomes the default account.
Instructions
Add (or re-authenticate) a Gmail account via a browser OAuth consent flow on this machine.
Args:
access ("readonly" | "modify" | "send", default "modify"): readonly = search and read only; modify = read plus labels, trash, drafts; send = modify plus send and reply.
allow_send (boolean, legacy): same as access "send"; ignored when access is set.
alias (string, optional): short name usable anywhere an 'account' parameter is accepted.
set_default (boolean, default false): make this the default account. The first account added is always the default.
Returns: the authenticated email address and granted scopes. A browser window opens for consent; if it does not, the consent URL is included in the response for manual opening. Re-adding an existing email overwrites its stored credentials (this is the re-auth path).
Examples:
{"access": "readonly"} — add a read-only account
{} — add an account that can read, label, trash, and draft, but not send
{"access": "send", "alias": "work", "set_default": true}
Error Handling: returns an actionable error if OAuth client credentials are missing (see README setup), if the user denies consent, or if the flow times out (5 minutes).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alias | No | Optional short name for this account (e.g. 'personal', 'work'). | |
| access | No | Access level. 'readonly' = search and read only (gmail.readonly). 'modify' = read plus labels, trash, drafts (gmail.modify). 'send' = modify plus send and reply. Overrides allow_send. Default 'modify'. | |
| allow_send | No | Legacy flag, same as access: 'send'. Ignored when access is set. Default false. | |
| set_default | No | Make this account the default for calls that omit 'account'. The first account added always becomes the default. |