Tracecat
Book a demo

Gmail integration

Search, label, draft, and manage messages in Gmail.

Email security
30 actions
tools.gmail
Also available as an MCP server. Connect agents to the Gmail MCP server.

How it works

Each Gmail action is a YAML template or Python function in Tracecat's open-source registry, under tools.gmail. Add an action as a step in a workflow, or give it to an agent as a tool.

Credentials

Add these in Tracecat before running the actions. How credentials work

  • Secret google_api (optional) with GOOGLE_API_CREDENTIALS and optional GOOGLE_API_SUBJECT
  • OAuth connection google_gmail_oauth (optional)

Actions

Missing an integration? Write your own actions in YAML or Python in a custom registry and sync them from your Git repository.

  • Batch delete messages

    Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all. Requires the `https://mail.google.com/` scope, which is not in the Gmail provider defaults: add it to the integration's scopes before connecting, or delegate it to the service account.

  • Batch modify messages

    Modifies the labels on the specified messages.

  • Create draft

    Creates a new draft with the DRAFT label. The RFC 2822 message is assembled from the inputs and base64url-encoded before it is sent.

  • Create label

    Creates a new label.

  • Delete draft

    Immediately and permanently deletes the specified draft. Does not simply trash it.

  • Delete label

    Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.

  • Delete message

    Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead. Requires the `https://mail.google.com/` scope, which is not in the Gmail provider defaults: add it to the integration's scopes before connecting, or delegate it to the service account.

  • Delete thread

    Immediately and permanently deletes the specified thread. Any messages that belong to the thread are also deleted. This operation cannot be undone. Prefer threads.trash instead. Requires the `https://mail.google.com/` scope, which is not in the Gmail provider defaults: add it to the integration's scopes before connecting, or delegate it to the service account.

  • Get draft

    Gets the specified draft.

  • Get Gmail attachment

    Download an attachment from a Gmail message

  • Get Gmail message

    Get full content of a Gmail message by ID

  • Get Gmail message headers

    Get only headers of a Gmail message (faster than full message)

  • Get Gmail thread

    Get all messages in an email thread

  • Get label

    Gets the specified label.

  • Get profile

    Gets the current user's Gmail profile.

  • List drafts

    Lists the drafts in the user's mailbox.

  • List Gmail labels

    List all Gmail labels for the user

  • List history

    Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId).

  • List threads

    Lists the threads in the user's mailbox.

  • Modify message

    Modifies the labels on the specified message.

  • Modify thread

    Modifies the labels applied to the thread. This applies to all messages in the thread.

  • Patch label

    Patch the specified label.

  • Search Gmail messages

    Search Gmail messages using Gmail's powerful query syntax

  • Send draft

    Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.

  • Send message

    Sends the specified message to the recipients in the To, Cc, and Bcc headers. The RFC 2822 message is assembled from the inputs and base64url-encoded before it is sent.

  • Trash message

    Moves the specified message to the trash.

  • Trash thread

    Moves the specified thread to the trash. Any messages that belong to the thread are also moved to the trash.

  • Untrash message

    Removes the specified message from the trash.

  • Untrash thread

    Removes the specified thread from the trash. Any messages that belong to the thread are also removed from the trash.

  • Update draft

    Replaces a draft's content. The RFC 2822 message is assembled from the inputs and base64url-encoded before it is sent.

Automate Gmail with Tracecat

Open-source workflows and agents for security teams.