batch_delete_messages
Delete multiple Gmail messages at once by specifying their IDs to clear inbox clutter and manage email storage efficiently.
Instructions
Delete multiple messages
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ids | Yes | The IDs of the messages to delete |
Implementation Reference
- src/index.ts:539-544 (handler)The handler function for the batch_delete_messages tool. It invokes handleTool for authentication and calls the Gmail API's users.messages.batchDelete method with the provided message IDs.async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.messages.batchDelete({ userId: 'me', requestBody: { ids: params.ids } }) return formatResponse(data) }) }
- src/index.ts:536-538 (schema)Zod input schema for the batch_delete_messages tool, requiring an array of message ID strings.{ ids: z.array(z.string()).describe("The IDs of the messages to delete") },
- src/index.ts:534-545 (registration)Registration of the batch_delete_messages tool on the MCP server using server.tool(), including name, description, schema, and handler.server.tool("batch_delete_messages", "Delete multiple messages", { ids: z.array(z.string()).describe("The IDs of the messages to delete") }, async (params) => { return handleTool(config, async (gmail: gmail_v1.Gmail) => { const { data } = await gmail.users.messages.batchDelete({ userId: 'me', requestBody: { ids: params.ids } }) return formatResponse(data) }) } )