create_forwarding_address
Set up email forwarding by creating a forwarding address that redirects incoming messages to another email account.
Instructions
Creates a forwarding address
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| forwardingEmail | Yes | An email address to which messages can be forwarded |
Implementation Reference
- src/index.ts:1077-1088 (registration)The tool 'create_forwarding_address' is registered via server.tool() with a description 'Creates a forwarding address', a single string parameter 'forwardingEmail', and an inline async handler that calls gmail.users.settings.forwardingAddresses.create.
server.tool("create_forwarding_address", "Creates a forwarding address", { forwardingEmail: z.string().describe("An email address to which messages can be forwarded") }, async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.settings.forwardingAddresses.create({ userId: 'me', requestBody: params }) return formatResponse(data) }) } ) - src/index.ts:1082-1087 (handler)The handler function for 'create_forwarding_address' invokes the Gmail API's forwardingAddresses.create method with the userId 'me' and the request body containing the forwardingEmail parameter, then wraps the result using formatResponse.
async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.settings.forwardingAddresses.create({ userId: 'me', requestBody: params }) return formatResponse(data) }) } - src/index.ts:1079-1081 (schema)The input schema for 'create_forwarding_address' is a Zod object with a required 'forwardingEmail' parameter (z.string()), which represents the email address to which messages can be forwarded.
{ forwardingEmail: z.string().describe("An email address to which messages can be forwarded") },