add_delegate
Add a delegate to your Gmail account to grant access for managing emails and settings. Simplify delegation with this direct tool.
Instructions
Adds a delegate to the specified account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| delegateEmail | Yes | Email address of delegate to add |
Implementation Reference
- src/index.ts:962-973 (registration)Registration and handler for the add_delegate tool. Registers the tool with name 'add_delegate', takes a delegateEmail string parameter via Zod schema, and the handler calls the Gmail API's users.settings.delegates.create endpoint.
server.tool("add_delegate", "Adds a delegate to the specified account", { delegateEmail: z.string().describe("Email address of delegate to add") }, async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.settings.delegates.create({ userId: 'me', requestBody: { delegateEmail: params.delegateEmail } }) return formatResponse(data) }) } ) - src/index.ts:964-966 (schema)Zod schema for add_delegate tool input. Defines a single required parameter 'delegateEmail' (string) describing the email address of the delegate to add.
{ delegateEmail: z.string().describe("Email address of delegate to add") }, - src/index.ts:967-973 (handler)Handler function for add_delegate. Uses handleTool to validate OAuth, then calls gmail.users.settings.delegates.create with the delegateEmail parameter and returns the formatted response.
async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.settings.delegates.create({ userId: 'me', requestBody: { delegateEmail: params.delegateEmail } }) return formatResponse(data) }) } )