Skip to main content
Glama

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
NameRequiredDescriptionDefault
labelFilterActionNoWhether to include or exclude the specified labels
labelIdsNoLabel IDs to restrict notifications to
topicNameYesThe name of the Cloud Pub/Sub topic to publish notifications to

Implementation Reference

  • 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) }) } )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shinzo-labs/gmail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server