delete_label
Remove a label from your Gmail account to organize your inbox by deleting unnecessary or outdated labels.
Instructions
Delete a Gmail label
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| labelId | Yes | Label ID to delete |
Implementation Reference
- src/tools.ts:108-111 (handler)The handler case within handleToolCall function that processes the 'delete_label' tool call, validates the input using Zod schema, calls gmailService.deleteLabel, and returns a success message.case "delete_label": { const v = validated as z.infer<typeof schemas.delete_label>; await gmailService.deleteLabel(v.labelId); return { content: [{ type: "text", text: `Label ${v.labelId} deleted successfully.` }] };
- src/tools.ts:15-15 (schema)Zod schema definition for the 'delete_label' tool input, specifying labelId as a required string.delete_label: z.object({ labelId: z.string().describe("Label ID to delete") }),
- src/tools.ts:50-55 (registration)Registration of all tools including 'delete_label' via getToolDefinitions, which generates JSON schemas from Zod schemas and includes descriptions for MCP tool discovery.export const getToolDefinitions = () => Object.entries(schemas).map(([name, schema]) => ({ name, description: toolDescriptions[name], inputSchema: zodToJsonSchema(schema) }));
- src/gmail-service.ts:93-95 (helper)The GmailService method that implements the core logic to delete a Gmail label using the Google Gmail API.async deleteLabel(id: string): Promise<void> { await this.gmail.users.labels.delete({ userId: 'me', id }); }