watch_mailbox
Monitor changes in a user's Gmail mailbox by specifying Cloud Pub/Sub topics and label filters. Configure notifications to include or exclude specific labels for targeted updates.
Instructions
Watch for changes to the user's mailbox
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| labelFilterAction | No | Whether to include or exclude the specified labels | |
| labelIds | No | Label IDs to restrict notifications to | |
| topicName | Yes | The name of the Cloud Pub/Sub topic to publish notifications to |
Implementation Reference
- src/index.ts:1314-1327 (handler)The watch_mailbox tool handler implementation. Registers the tool with schema and executes gmail.users.watch to watch for mailbox changes, using shared handleTool for auth and error handling.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) }) } )