watch_mailbox
Set up a Cloud Pub/Sub topic to receive notifications when your mailbox changes, with optional label filters to monitor specific labels.
Instructions
Watch for changes to the user's mailbox
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topicName | Yes | The name of the Cloud Pub/Sub topic to publish notifications to | |
| labelIds | No | Label IDs to restrict notifications to | |
| labelFilterAction | No | Whether to include or exclude the specified labels |
Implementation Reference
- src/index.ts:1314-1327 (registration)Registration of the 'watch_mailbox' tool via server.tool() with its schema definition
server.tool("watch_mailbox", "Watch for changes to the user's mailbox", { topicName: z.string().describe("The name of the Cloud Pub/Sub topic to publish notifications to"), labelIds: z.array(z.string()).optional().describe("Label IDs to restrict notifications to"), labelFilterAction: z.enum(['include', 'exclude']).optional().describe("Whether to include or exclude the specified labels") }, async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.watch({ userId: 'me', requestBody: params }) return formatResponse(data) }) } ) - src/index.ts:1321-1327 (handler)Handler function executed when 'watch_mailbox' is called; calls gmail.users.watch() with topicName, labelIds, and labelFilterAction parameters
async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.watch({ userId: 'me', requestBody: params }) return formatResponse(data) }) } ) - src/index.ts:1316-1320 (schema)Input schema for 'watch_mailbox': topicName (required string), labelIds (optional array of strings), labelFilterAction (optional enum 'include'/'exclude')
{ topicName: z.string().describe("The name of the Cloud Pub/Sub topic to publish notifications to"), labelIds: z.array(z.string()).optional().describe("Label IDs to restrict notifications to"), labelFilterAction: z.enum(['include', 'exclude']).optional().describe("Whether to include or exclude the specified labels") },