# Gmail - All Email Actions

## Links

- Product page URL: https://www.agentpmt.com/marketplace/gmail-all-email-actions
- Product markdown URL: https://www.agentpmt.com/marketplace/gmail-all-email-actions?format=agent-md
- Product JSON URL: https://www.agentpmt.com/marketplace/gmail-all-email-actions?format=agent-json

## Overview

- Product ID: 69618e485d4cf4d4b6af40f0
- Type: connector
- Unit type: request
- Price: 500 credits
- Categories: Project Management, Automation, Sales Engagement & Outreach, Email Marketing & Campaigns, Marketing Automation, Task & Workflow Automation
- Generated at: 2026-07-14T22:11:08.753Z

### Page Description

Gmail connection that enables agents to send, read, search, and manage email through Google OAuth integration. The tool provides comprehensive email functionality including composing and sending new messages with attachments, replying to emails while maintaining thread continuity, and forwarding messages to new recipients. Agents can search and filter emails using Gmail's powerful query syntax to find specific messages by sender, subject, date, labels, or attachment status. The tool supports full email lifecycle management including reading message content with parsed headers and body text, moving messages to trash or permanently deleting them, and modifying labels to organize emails or mark them as read. Draft functionality allows agents to create, retrieve, and send draft emails for workflows requiring human review before sending. Additional capabilities include listing all available labels for organization, retrieving user profile information such as email address and message counts, and sending from custom authenticated email addresses.

### Agent Description

Gmail integration: send, read, search, reply, forward emails. Manage labels, drafts, trash. Supports attachments and custom from addresses.

## Details

### Details

Gmail connection that enables agents to send, read, search, and manage email through Google OAuth integration. The tool provides comprehensive email functionality including composing and sending new messages with attachments, replying to emails while maintaining thread continuity, and forwarding messages to new recipients. Agents can search and filter emails using Gmail's powerful query syntax to find specific messages by sender, subject, date, labels, or attachment status. The tool supports full email lifecycle management including reading message content with parsed headers and body text, moving messages to trash or permanently deleting them, and modifying labels to organize emails or mark them as read. Draft functionality allows agents to create, retrieve, and send draft emails for workflows requiring human review before sending. Additional capabilities include listing all available labels for organization, retrieving user profile information such as email address and message counts, and sending from custom authenticated email addresses.

### Actions

- `send_message` (5 credits): Send a new email. Supports plain text, HTML, attachments, CC/BCC, custom from address, and optional thread continuation.
- `reply_message` (5 credits): Reply to an existing email. The reply stays in the same thread and automatically uses the original subject and recipient context.
- `forward_message` (5 credits): Forward an email to new recipients. The source message content is included automatically.
- `list_messages` (5 credits): Search and list Gmail messages for triage. The tool requests a Gmail message page, fetches compact metadata for each listed message, then applies post-fetch date/category/label filters and optional thread dedupe. Returns messages plus result_size_estimate, next_page_token, fetched_count, and returned_count; returned_count can be lower than fetched_count.
- `get_message` (5 credits): Read a Gmail message with safe body and metadata controls.
- `get_thread` (5 credits): Read Gmail thread messages with safe body and metadata controls.
- `trash_message` (5 credits): Move an email message to trash.
- `untrash_message` (5 credits): Restore an email message from trash.
- `modify_labels` (5 credits): Add or remove labels from an email. Common uses: mark as read, star, or archive.
- `list_labels` (5 credits): List all available Gmail labels, including system and user-created labels.
- `create_draft` (5 credits): Create a draft email that can be edited or sent later.
- `send_draft` (5 credits): Send a previously created Gmail draft.
- `get_draft` (5 credits): Retrieve draft email content with safe body and metadata controls.
- `delete_draft` (5 credits): Permanently delete a Gmail draft.
- `get_profile` (5 credits): Get the authenticated Gmail profile including email address and message/thread counts.

### Use Cases

Automated email notifications and alerts, Customer inquiry response and follow-up, Email search and retrieval for information gathering, Inbox management and organization with labels, Draft creation for human-in-the-loop email workflows, Email forwarding and delegation workflows, Reading and summarizing email content, Marking messages as read or starring important emails, Sending reports and documents as attachments, Monitoring inbox for specific senders or keywords

### Workflows Using This Tool

#### Property Lead CSV Outreach and CRM Pipeline

Automated real estate investor outreach pipeline that processes a CSV file of property owners, adds each contact as a lead in Zoho CRM, drafts personalized introductory purchase-interest emails in Gmail, and schedules follow-up call tasks in Zoho CRM for three days later. Designed for real estate investors who want to scale their direct-to-owner outreach campaigns from a spreadsheet of property contacts.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/property-lead-csv-outreach-and-crm-pipeline
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/property-lead-csv-outreach-and-crm-pipeline?format=agent-md
- Published: 2026-07-03T19:50:22.754Z

#### Hourly Gmail Categorizer with Urgent Telegram Alerts

Runs every hour to fetch unread Gmail emails, categorizes them into four buckets (Account Notifications, Marketing, Human, Urgent), and sends a Telegram alert for any urgent emails that need a timely response. Non-urgent runs are logged silently.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/hourly-gmail-categorizer-with-urgent-telegram-alerts
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/hourly-gmail-categorizer-with-urgent-telegram-alerts?format=agent-md
- Published: 2026-06-11T18:30:37.537Z

#### Pipedrive AI Email Writer: Personalized Human-Voice Nurture and Follow-Up Drafts for Any CRM Segment

Turn any Pipedrive segment into a set of genuinely personal sales emails, written one contact at a time and waiting in your Gmail drafts for your final say. Point this AI email writing workflow at a pipeline stage, an owner, a label, or stalled deals with no recent activity, and it pulls each contact's deal history and notes from Pipedrive, finds the strongest personal hook for every relationship, and writes each email in a natural human voice around your goal: re-engaging a quiet deal, a renewal check-in, post-sale nurture, an upsell conversation, or a simple hello. Every email passes an automated writing quality check that catches robotic, overused AI phrasing and rewrites it before you ever see it. Nothing is sent automatically. Each message lands as a Gmail draft for you to review and send personally, while the workflow logs a note and a follow-up activity on every deal in Pipedrive, records the campaign in a Google Sheets log, and emails you a summary of what is ready. Built for account executives, customer success teams, founders doing their own outreach, sales follow-up and renewal plays, and anyone who wants CRM email automation that produces one-to-one messages that read like they wrote them.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-nurture-email-writer-personalized-human-voice-outreach-drafts-for-any-crm-segment
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-nurture-email-writer-personalized-human-voice-outreach-drafts-for-any-crm-segment?format=agent-md
- Published: 2026-06-10T20:59:48.301Z

#### Human-Voice AI Blog Writer: Research, Write, and Illustrate SEO Articles from Your Content Calendar

Turn a topic or a content-calendar spreadsheet into a publish-ready, fact-checked blog article written in a natural human voice. This AI blog writing workflow picks the next due topic from your Google Sheet (or takes one directly), researches it across live news and authoritative web sources, builds a sourced fact sheet and SEO outline, then drafts the full long-form article with a human-style writing agent that writes only from verified facts. Every draft runs through an automated writing quality check that catches robotic, banned AI phrases and rewrites them until the copy passes. A custom hero image is generated to match the story, the finished article is assembled into a formatted Google Doc with a sources section, the run is logged back to your content calendar, and the doc link lands in your inbox. Ideal for content marketing teams, SEO agencies, founders, newsletters, and solo bloggers who want an AI blog post generator and content automation pipeline that delivers consistent, on-brand, long-form SEO content without the research grind or the telltale AI voice.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/human-voice-blog-factory-research-write-illustrate-and-deliver-seo-articles-from-your-content-calendar
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/human-voice-blog-factory-research-write-illustrate-and-deliver-seo-articles-from-your-content-calendar?format=agent-md
- Published: 2026-06-10T20:59:39.285Z

#### Pipedrive Field Sales Route Planner: Optimized In-Person Visit Itineraries with Maps & Talking Points

Plan a high-impact day of in-person sales visits straight from your CRM. Give this AI workflow a city or area and it pulls every relevant Pipedrive contact and open deal there, optimizes the most efficient driving route across the stops, and generates a map plus a timed itinerary with arrival windows. For each visit it briefs the rep with last activity, open-deal status, and specific talking points drawn from the contact's notes, and can pre-plan a small gift to bring. The finished plan is delivered as a shareable document with calendar events for every stop. Perfect for field sales, account-based selling, territory planning, customer check-ins, QBR tours, and outside sales reps who want CRM-driven, route-optimized visit planning Pipedrive doesn't offer.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-field-sales-route-planner-optimized-in-person-visit-itineraries-with-maps-talking-points
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-field-sales-route-planner-optimized-in-person-visit-itineraries-with-maps-talking-points?format=agent-md
- Published: 2026-06-10T02:47:37.923Z

#### Pipedrive Renewal Reminder & Retention Gifting: Tiered Cards and Gift Baskets Before Renewal Dates

Protect your recurring revenue with a proactive, multi-touch renewal play. This AI workflow watches the renewal and contract dates on your Pipedrive deals and accounts and runs a tiered gifting ladder as each renewal approaches — a thoughtful greeting card at 60 days, then a fruit basket or flowers at 30 days when engagement has gone quiet — while creating timed follow-up activities for the account owner so nothing slips. It personalizes every message from the contact's deal notes and logs each gesture back into the CRM. Ideal for subscription and SaaS renewals, customer retention, churn prevention, account management, customer success, and revenue teams who want a relationship-driven renewal cadence Pipedrive can't orchestrate on its own.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-renewal-reminder-retention-gifting-tiered-cards-and-gift-baskets-before-renewal-dates
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-renewal-reminder-retention-gifting-tiered-cards-and-gift-baskets-before-renewal-dates?format=agent-md
- Published: 2026-06-10T02:47:32.812Z

#### Pipedrive Account News Monitor: Auto-Send Congratulations Cards & Flowers on Client Milestones

Never miss a reason to reach out. This AI workflow monitors the news for your most important Pipedrive accounts every week — funding rounds, awards, expansions, product launches, and executive hires — and turns real headlines into perfectly timed, genuinely relevant congratulations. The agent drafts a personalized note that references the actual news, mails a printed greeting card, and for major milestones like a funding round sends flowers, then logs the outreach and the source article onto the account in Pipedrive and alerts the deal owner. Built for account-based selling, relationship management, customer marketing, executive engagement, and sales teams who want to look remarkably attentive — a timely, news-triggered gifting play Pipedrive cannot do natively.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-account-news-monitor-auto-send-congratulations-cards-flowers-on-client-milestones
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-account-news-monitor-auto-send-congratulations-cards-flowers-on-client-milestones?format=agent-md
- Published: 2026-06-10T02:47:26.060Z

#### Pipedrive Personalized Direct Mail Engine: AI-Designed Greeting Cards to Any CRM Segment

Turn any Pipedrive segment into a personalized direct-mail campaign in minutes. Point this AI workflow at a Pipedrive filter — a pipeline stage, a customer tier, a sales territory, or won deals this quarter — and it writes a unique, on-brand message for every contact from their real deal history and notes, designs a custom greeting-card cover with AI image generation, and mails a premium printed, folded card to each recipient's address with USPS tracking. Every send is logged back onto the contact record for a complete touch history. Perfect for holiday card campaigns, customer appreciation mailers, account-based marketing, thank-you and welcome cards, re-engagement direct mail, and personalized print outreach at scale — the high-response offline channel Pipedrive has no native way to run.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-personalized-direct-mail-engine-ai-designed-greeting-cards-to-any-crm-segment
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-personalized-direct-mail-engine-ai-designed-greeting-cards-to-any-crm-segment?format=agent-md
- Published: 2026-06-10T02:47:20.852Z

#### Pipedrive At-Risk Deal Rescue: Auto-Send Flowers & Gift Baskets to Stalled High-Value Accounts

Automatically win back stalled, high-value Pipedrive deals before they go cold. This AI sales workflow scans your CRM for your most valuable open deals and key accounts with no activity in the last N days, ranks them by deal value, and sends a perfectly chosen physical gift — a handwritten greeting card, a fruit basket, or fresh flowers — scaled to the size of the relationship. It reads each contact's deal notes to personalize the card message and avoid preference and allergy missteps, ships to their address, logs the gesture as a Pipedrive note and follow-up activity, and alerts the deal owner. Ideal for account-based selling, customer retention, churn prevention, pipeline re-engagement, VIP client management, and revenue teams who want to revive aging deals with a human touch Pipedrive can't automate on its own.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-at-risk-deal-rescue-auto-send-flowers-gift-baskets-to-stalled-high-value-accounts
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/pipedrive-at-risk-deal-rescue-auto-send-flowers-gift-baskets-to-stalled-high-value-accounts?format=agent-md
- Published: 2026-06-10T02:46:49.086Z

#### AI Gmail Inbox Classifier & Auto-Archive with Hourly Telegram Alerts

Automatically organize and clean up your Gmail inbox every hour, hands-free. This AI email automation reads each new message, classifies it into one of seven of your own Gmail labels (across the "00 Automated" and "00 Human" label groups), applies the right label, and archives it out of your inbox — so you reach inbox zero without lifting a finger. The moment a message is tagged Important, you get an instant Telegram alert with a direct link to that email, so urgent messages never slip through. Ideal for busy professionals and teams who want smart email sorting, automated inbox triage, and real-time Telegram notifications for the emails that actually matter.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/ai-gmail-inbox-classifier-auto-archive-with-hourly-telegram-alerts
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/ai-gmail-inbox-classifier-auto-archive-with-hourly-telegram-alerts?format=agent-md
- Published: 2026-06-08T19:03:14.988Z

#### Gmail Inbox Triage to Telegram - Urgency and Intent

Sweeps your Gmail inbox for emails received in the last 24 hours, looks up each sender's prior Gmail history to classify them as existing customer, new inquiry, marketing, or automated, scores urgency, and sends a single Telegram digest containing only the high and medium urgency emails that actually need your reply. Skips marketing, no-reply notifications, and one-way confirmations.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/gmail-inbox-triage-to-telegram-urgency-and-intent
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/gmail-inbox-triage-to-telegram-urgency-and-intent?format=agent-md
- Published: 2026-05-27T01:06:27.207Z

#### Expense Report Processor

Processes employee expense reports by accepting receipt uploads, extracting receipt data via OCR, categorizing expenses, booking them to Zoho Books with correct expense accounts, generating an expense breakdown chart, and sending the compiled report for manager approval. Streamlines the entire expense reimbursement process.

- Page URL: https://www.agentpmt.com/agent-workflow-skills/expense-report-processor
- Markdown URL: https://www.agentpmt.com/agent-workflow-skills/expense-report-processor?format=agent-md
- Published: 2026-04-19T18:29:42.593Z

### Related Content

#### Build a Gmail-to-Telegram AI Workflow in 60 Seconds

- Type: video
- Page URL: https://www.agentpmt.com/videos/build-a-gmail-to-telegram-ai-workflow-in-60-seconds
- Markdown URL: Not available for this content type
Stephanie Goodman walks through signing up for AgentPMT in under a minute, connecting Gmail through the encrypted Vault, and typing a plain-language request in 'Automate Now' to build a no-code workflow that scans email each hour, categorizes messages, and sends urgent Telegram alerts.

## Integration Details

### DynamicMCP

- Setup page URL: https://www.agentpmt.com/dynamic-mcp
- Claude setup guide: https://www.agentpmt.com/dynamic-mcp#platform=claude
- ChatGPT setup guide: https://www.agentpmt.com/dynamic-mcp#platform=chatgpt
- Cursor setup guide: https://www.agentpmt.com/dynamic-mcp#platform=cursor
- Windsurf setup guide: https://www.agentpmt.com/dynamic-mcp#platform=windsurf

Use the local router for command-based MCP clients. It forwards requests to `https://api.agentpmt.com/mcp` and does not execute tools locally.

```bash
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

### REST API

The live page renders cURL, Python, JavaScript, and Node.js examples. Logged-in users see those examples prefilled with their own API and budget credentials.

- Purchase endpoint: https://api.agentpmt.com/products/purchase
- Authorization format: `Bearer <base64(apiKey:budgetKey)>`

```bash
curl -X POST "https://api.agentpmt.com/products/purchase" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eW91ci1hcGkta2V5LWhlcmU6eW91ci1idWRnZXQta2V5LWhlcmU=" \
  -d '{
    "product_id": "69618e485d4cf4d4b6af40f0",
    "parameters": {
      "action": "get_instructions"
    }
  }'
```

### Autonomous Agents

Autonomous agents can access this tool through AgentAddress credit balances or direct x402 payments. Use the Autonomous Agent API reference for endpoint shapes after choosing the access pattern below.

- Autonomous Agent API reference URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents
- Autonomous Agent API reference markdown URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents?format=agent-md
- Credit-Based Access Using AgentAddress: https://www.agentpmt.com/docs/autonomous-agents/credit-based-tool-usage-with-agentaddress
- AgentAddress is preferred for persistent file access, stored platform state, and maximum tool use ability across repeated calls.
- Direct x402 is for independent one-off tool calls that do not require shared files or stored platform state.
- Direct x402 public payments: USDC on Base, Arbitrum, Optimism, Polygon, and Avalanche.

#### Product Skill Package

This product has a published Agent Skill package for product-specific operating instructions.

- Skill slug: gmail-all-email-actions
- Version: 1.0.0
- Download SKILL.md: https://raw.githubusercontent.com/AgentPMT/agent-skills/main/skills/gmail-all-email-actions/SKILL.md
- Package source: https://github.com/AgentPMT/agent-skills/tree/main/skills/gmail-all-email-actions
- OpenClaw listing: https://clawhub.ai/agentpmt/gmail-all-email-actions
- OpenClaw install: `openclaw skills install gmail-all-email-actions`
- skills.sh install: `npx skills add AgentPMT/agent-skills --skill gmail-all-email-actions`
- Last published: 2026-06-24T02:02:18.276Z

### Schema

#### Credentials

These runtime credentials should be provided under `parameters._credentials` when required.

- Google OAuth (`google_oauth`, oauth_token, required)
  Help: Connect your Google account.
  Connection ID: 69616abea90ed54743f01957

#### Parameters

- Schema type: actions

```json
{
  "actions": {
    "get_instructions": {
      "description": "Return Gmail tool usage instructions and examples."
    },
    "send_message": {
      "description": "Send a new email. Supports plain text, HTML, attachments, CC/BCC, custom from address, and optional thread continuation.",
      "properties": {
        "to": {
          "type": "array",
          "description": "Recipient email addresses.",
          "required": true,
          "items": {
            "type": "string"
          }
        },
        "subject": {
          "type": "string",
          "description": "Email subject line.",
          "required": true
        },
        "body_text": {
          "type": "string",
          "description": "Plain text email body. Required unless body_html is provided.",
          "required": false
        },
        "body_html": {
          "type": "string",
          "description": "HTML email body. Can be used instead of or in addition to body_text.",
          "required": false
        },
        "cc": {
          "type": "array",
          "description": "CC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "bcc": {
          "type": "array",
          "description": "BCC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "from_email": {
          "type": "string",
          "description": "From address override. Only works if the Gmail account has a configured send-as alias.",
          "required": false
        },
        "thread_id": {
          "type": "string",
          "description": "Thread ID to add this message to an existing conversation thread.",
          "required": false
        },
        "attachments": {
          "type": "array",
          "description": "Email attachments. Provide public file URLs that will be fetched and attached.",
          "required": false,
          "items": {
            "type": "object",
            "properties": {
              "filename": {
                "type": "string",
                "description": "Attachment filename such as report.pdf or image.png.",
                "required": true
              },
              "file_url": {
                "type": "string",
                "description": "Public URL to fetch the file from. Must be directly accessible.",
                "required": true
              },
              "content_type": {
                "type": "string",
                "description": "MIME type such as application/pdf. Auto-detected from the URL response when omitted.",
                "required": false,
                "default": "application/octet-stream"
              }
            }
          }
        }
      }
    },
    "reply_message": {
      "description": "Reply to an existing email. The reply stays in the same thread and automatically uses the original subject and recipient context.",
      "properties": {
        "message_id": {
          "type": "string",
          "description": "Gmail message ID of the email to reply to.",
          "required": true
        },
        "body_text": {
          "type": "string",
          "description": "Plain text reply body. Required unless body_html is provided.",
          "required": false
        },
        "body_html": {
          "type": "string",
          "description": "HTML reply body. Can be used instead of or in addition to body_text.",
          "required": false
        },
        "cc": {
          "type": "array",
          "description": "CC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "bcc": {
          "type": "array",
          "description": "BCC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "attachments": {
          "type": "array",
          "description": "Email attachments. Provide public file URLs that will be fetched and attached.",
          "required": false,
          "items": {
            "type": "object",
            "properties": {
              "filename": {
                "type": "string",
                "description": "Attachment filename.",
                "required": true
              },
              "file_url": {
                "type": "string",
                "description": "Public URL to fetch the file from.",
                "required": true
              },
              "content_type": {
                "type": "string",
                "description": "MIME type. Auto-detected when omitted.",
                "required": false,
                "default": "application/octet-stream"
              }
            }
          }
        }
      }
    },
    "forward_message": {
      "description": "Forward an email to new recipients. The source message content is included automatically.",
      "properties": {
        "message_id": {
          "type": "string",
          "description": "Gmail message ID of the email to forward.",
          "required": true
        },
        "to": {
          "type": "array",
          "description": "Recipient email addresses to forward to.",
          "required": true,
          "items": {
            "type": "string"
          }
        },
        "body_text": {
          "type": "string",
          "description": "Optional text to add above the forwarded content.",
          "required": false
        },
        "cc": {
          "type": "array",
          "description": "CC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "bcc": {
          "type": "array",
          "description": "BCC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "attachments": {
          "type": "array",
          "description": "Additional email attachments. Provide public file URLs that will be fetched and attached.",
          "required": false,
          "items": {
            "type": "object",
            "properties": {
              "filename": {
                "type": "string",
                "description": "Attachment filename.",
                "required": true
              },
              "file_url": {
                "type": "string",
                "description": "Public URL to fetch the file from.",
                "required": true
              },
              "content_type": {
                "type": "string",
                "description": "MIME type. Auto-detected when omitted.",
                "required": false,
                "default": "application/octet-stream"
              }
            }
          }
        }
      }
    },
    "list_messages": {
      "description": "Search and list Gmail messages for triage. The tool requests a Gmail message page, fetches compact metadata for each listed message, then applies post-fetch date/category/label filters and optional thread dedupe. Returns messages plus result_size_estimate, next_page_token, fetched_count, and returned_count; returned_count can be lower than fetched_count.",
      "properties": {
        "q": {
          "type": "string",
          "description": "Gmail search query. Examples: is:unread, from:user@example.com, subject:meeting, has:attachment, newer_than:7d.",
          "required": false
        },
        "max_results": {
          "type": "integer",
          "description": "Maximum Gmail API page size before metadata shaping, post-fetch filters, and thread dedupe (1-500).",
          "required": false,
          "default": 20,
          "minimum": 1,
          "maximum": 500
        },
        "page_token": {
          "type": "string",
          "description": "Pagination token from a previous list_messages response.",
          "required": false
        },
        "label_ids": {
          "type": "array",
          "description": "Include only messages with these Gmail label IDs in the upstream Gmail list request.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "include_spam_trash": {
          "type": "boolean",
          "description": "Include spam and trash in the upstream Gmail list request. Defaults to false.",
          "required": false,
          "default": false
        },
        "min_internal_date_ms": {
          "type": "integer",
          "description": "Post-fetch filter: exclude messages with internalDate earlier than this millisecond timestamp.",
          "required": false,
          "minimum": 0
        },
        "max_internal_date_ms": {
          "type": "integer",
          "description": "Post-fetch filter: exclude messages with internalDate later than this millisecond timestamp.",
          "required": false,
          "minimum": 0
        },
        "exclude_label_ids": {
          "type": "array",
          "description": "Post-fetch filter: exclude messages containing any of these Gmail label IDs.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "exclude_categories": {
          "type": "array",
          "description": "Post-fetch filter: exclude Gmail categories such as promotions, social, updates, and forums.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "dedupe_by_thread": {
          "type": "boolean",
          "description": "Return only the first retained message per thread after post-fetch filters. Defaults to true.",
          "required": false,
          "default": true
        }
      }
    },
    "get_message": {
      "description": "Read a Gmail message with safe body and metadata controls.",
      "properties": {
        "message_id": {
          "type": "string",
          "description": "Gmail message ID.",
          "required": true
        },
        "message_format": {
          "type": "string",
          "description": "Preferred read format. minimal returns IDs/labels only; metadata returns headers/snippet/signals with no body fields; text returns capped text only; full returns metadata plus selected body fields.",
          "required": false,
          "enum": [
            "minimal",
            "metadata",
            "text",
            "full"
          ]
        },
        "format": {
          "type": "string",
          "description": "Deprecated legacy alias for message_format. Use message_format for new calls.",
          "required": false,
          "enum": [
            "full",
            "metadata",
            "minimal"
          ]
        },
        "metadata_headers": {
          "type": "array",
          "description": "Headers to request and return in metadata modes.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "body_format": {
          "type": "string",
          "description": "Body fields to return when message_format is full. Defaults to text. Use html or both only when raw HTML is explicitly needed.",
          "required": false,
          "enum": [
            "none",
            "text",
            "html",
            "both"
          ]
        },
        "max_body_chars": {
          "type": "integer",
          "description": "Maximum characters returned per selected body field. Defaults to 8000.",
          "required": false,
          "minimum": 0,
          "maximum": 100000
        }
      }
    },
    "get_thread": {
      "description": "Read Gmail thread messages with safe body and metadata controls.",
      "properties": {
        "thread_id": {
          "type": "string",
          "description": "Gmail thread ID.",
          "required": true
        },
        "message_format": {
          "type": "string",
          "description": "Preferred read format for thread messages: minimal, metadata, text, or full.",
          "required": false,
          "enum": [
            "minimal",
            "metadata",
            "text",
            "full"
          ]
        },
        "format": {
          "type": "string",
          "description": "Deprecated legacy alias for message_format. Use message_format for new calls.",
          "required": false,
          "enum": [
            "full",
            "metadata",
            "minimal"
          ]
        },
        "metadata_headers": {
          "type": "array",
          "description": "Headers to request and return in metadata modes.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "body_format": {
          "type": "string",
          "description": "Body fields to return when message_format is full. Defaults to text.",
          "required": false,
          "enum": [
            "none",
            "text",
            "html",
            "both"
          ]
        },
        "max_body_chars": {
          "type": "integer",
          "description": "Maximum characters returned per selected body field. Defaults to 8000.",
          "required": false,
          "minimum": 0,
          "maximum": 100000
        },
        "max_messages": {
          "type": "integer",
          "description": "Maximum thread messages to return (1-100). Defaults to 25.",
          "required": false,
          "minimum": 1,
          "maximum": 100,
          "default": 25
        },
        "include_html": {
          "type": "boolean",
          "description": "Shortcut that includes HTML when body_format is omitted. Defaults to false; body_format is the canonical selector.",
          "required": false,
          "default": false
        }
      }
    },
    "trash_message": {
      "description": "Move an email message to trash.",
      "properties": {
        "message_id": {
          "type": "string",
          "description": "Gmail message ID of the email to trash.",
          "required": true
        }
      }
    },
    "untrash_message": {
      "description": "Restore an email message from trash.",
      "properties": {
        "message_id": {
          "type": "string",
          "description": "Gmail message ID of the email to restore.",
          "required": true
        }
      }
    },
    "modify_labels": {
      "description": "Add or remove labels from an email. Common uses: mark as read, star, or archive.",
      "properties": {
        "message_id": {
          "type": "string",
          "description": "Gmail message ID.",
          "required": true
        },
        "add_label_ids": {
          "type": "array",
          "description": "Label IDs to add. Common values: STARRED, IMPORTANT, UNREAD.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "remove_label_ids": {
          "type": "array",
          "description": "Label IDs to remove. Common values: UNREAD to mark read, INBOX to archive.",
          "required": false,
          "items": {
            "type": "string"
          }
        }
      }
    },
    "list_labels": {
      "description": "List all available Gmail labels, including system and user-created labels."
    },
    "create_draft": {
      "description": "Create a draft email that can be edited or sent later.",
      "properties": {
        "to": {
          "type": "array",
          "description": "Recipient email addresses.",
          "required": true,
          "items": {
            "type": "string"
          }
        },
        "subject": {
          "type": "string",
          "description": "Email subject line.",
          "required": true
        },
        "body_text": {
          "type": "string",
          "description": "Plain text email body. Required unless body_html is provided.",
          "required": false
        },
        "body_html": {
          "type": "string",
          "description": "HTML email body. Can be used instead of or in addition to body_text.",
          "required": false
        },
        "cc": {
          "type": "array",
          "description": "CC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "bcc": {
          "type": "array",
          "description": "BCC recipients.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "from_email": {
          "type": "string",
          "description": "From address override. Only works if the Gmail account has a configured send-as alias.",
          "required": false
        },
        "thread_id": {
          "type": "string",
          "description": "Thread ID to associate the draft with an existing conversation.",
          "required": false
        },
        "attachments": {
          "type": "array",
          "description": "Email attachments. Provide public file URLs that will be fetched and attached.",
          "required": false,
          "items": {
            "type": "object",
            "properties": {
              "filename": {
                "type": "string",
                "description": "Attachment filename.",
                "required": true
              },
              "file_url": {
                "type": "string",
                "description": "Public URL to fetch the file from.",
                "required": true
              },
              "content_type": {
                "type": "string",
                "description": "MIME type. Auto-detected when omitted.",
                "required": false,
                "default": "application/octet-stream"
              }
            }
          }
        }
      }
    },
    "send_draft": {
      "description": "Send a previously created Gmail draft.",
      "properties": {
        "draft_id": {
          "type": "string",
          "description": "Gmail draft ID.",
          "required": true
        }
      }
    },
    "get_draft": {
      "description": "Retrieve draft email content with safe body and metadata controls.",
      "properties": {
        "draft_id": {
          "type": "string",
          "description": "Gmail draft ID.",
          "required": true
        },
        "message_format": {
          "type": "string",
          "description": "Preferred read format: minimal, metadata, text, or full.",
          "required": false,
          "enum": [
            "minimal",
            "metadata",
            "text",
            "full"
          ]
        },
        "format": {
          "type": "string",
          "description": "Deprecated legacy alias for message_format. Use message_format for new calls.",
          "required": false,
          "enum": [
            "full",
            "metadata",
            "minimal"
          ]
        },
        "metadata_headers": {
          "type": "array",
          "description": "Headers to request and return in metadata modes.",
          "required": false,
          "items": {
            "type": "string"
          }
        },
        "body_format": {
          "type": "string",
          "description": "Body fields to return when message_format is full. Defaults to text.",
          "required": false,
          "enum": [
            "none",
            "text",
            "html",
            "both"
          ]
        },
        "max_body_chars": {
          "type": "integer",
          "description": "Maximum characters returned per selected body field. Defaults to 8000.",
          "required": false,
          "minimum": 0,
          "maximum": 100000
        }
      }
    },
    "delete_draft": {
      "description": "Permanently delete a Gmail draft.",
      "properties": {
        "draft_id": {
          "type": "string",
          "description": "Gmail draft ID to delete.",
          "required": true
        }
      }
    },
    "get_profile": {
      "description": "Get the authenticated Gmail profile including email address and message/thread counts."
    }
  }
}
```

### Usage Instructions

# Gmail - All Email Actions

Complete Gmail management: send, reply, forward, search, read, trash, label, and draft emails.

## Actions

### send_message
Send a new email.

**Required:** `to` (array of email addresses), `subject`, `body_text` or `body_html`
**Optional:** `cc`, `bcc`, `from_email` (requires send-as alias configured in Gmail), `body_html`, `attachments`, `thread_id`

```json
{
  "action": "send_message",
  "to": ["recipient@example.com"],
  "subject": "Project Update",
  "body_text": "Hi, here is the latest update on the project.",
  "cc": ["manager@example.com"]
}
```

**With attachment:**
```json
{
  "action": "send_message",
  "to": ["team@example.com"],
  "subject": "Monthly Report",
  "body_text": "Please find the report attached.",
  "attachments": [
    {
      "filename": "report.pdf",
      "file_url": "https://example.com/files/report.pdf",
      "content_type": "application/pdf"
    }
  ]
}
```

### reply_message
Reply to an existing email. The reply stays in the same thread and automatically uses the original subject and recipient.

**Required:** `message_id`, `body_text` or `body_html`
**Optional:** `cc`, `bcc`, `attachments`

```json
{
  "action": "reply_message",
  "message_id": "18a1b2c3d4e5f6g7",
  "body_text": "Thanks for the update. I'll review this by Friday."
}
```

### forward_message
Forward an email to new recipients. The original message content is included automatically.

**Required:** `message_id`, `to`
**Optional:** `body_text` (added above the forwarded content), `cc`, `bcc`, `attachments`

```json
{
  "action": "forward_message",
  "message_id": "18a1b2c3d4e5f6g7",
  "to": ["colleague@example.com"],
  "body_text": "FYI - see the message below."
}
```

### list_messages
Search and list emails. Returns message IDs and thread IDs. Use `get_message` to read full content.

**Required:** none
**Optional:** `q` (Gmail search query), `max_results` (1-500, default 20), `label_ids`, `page_token`

```json
{
  "action": "list_messages",
  "q": "is:unread from:boss@example.com",
  "max_results": 10
}
```

**Common search queries:**
- `is:unread` - unread messages
- `from:user@example.com` - from a specific sender
- `subject:meeting` - subject contains "meeting"
- `has:attachment` - messages with attachments
- `newer_than:7d` - from the last 7 days
- `older_than:30d` - older than 30 days
- `in:sent` - sent messages
- `label:work` - messages with a specific label

### get_message
Read the full content of an email including headers, body, and attachment metadata.

**Required:** `message_id`
**Optional:** `format` - `full` (default, headers + body), `metadata` (headers only), `minimal` (IDs only)

```json
{
  "action": "get_message",
  "message_id": "18a1b2c3d4e5f6g7",
  "format": "full"
}
```

### trash_message
Move an email to the trash.

**Required:** `message_id`

```json
{
  "action": "trash_message",
  "message_id": "18a1b2c3d4e5f6g7"
}
```

### untrash_message
Restore an email from the trash back to its original location.

**Required:** `message_id`

```json
{
  "action": "untrash_message",
  "message_id": "18a1b2c3d4e5f6g7"
}
```

### modify_labels
Add or remove labels from an email. Use `list_labels` first to find available label IDs.

**Required:** `message_id`, at least one of `add_label_ids` or `remove_label_ids`

```json
{
  "action": "modify_labels",
  "message_id": "18a1b2c3d4e5f6g7",
  "add_label_ids": ["STARRED"],
  "remove_label_ids": ["UNREAD"]
}
```

**Common label IDs:** `INBOX`, `SENT`, `TRASH`, `DRAFT`, `SPAM`, `STARRED`, `IMPORTANT`, `UNREAD`, `CATEGORY_PERSONAL`, `CATEGORY_SOCIAL`, `CATEGORY_PROMOTIONS`

**Useful patterns:**
- Mark as read: `remove_label_ids: ["UNREAD"]`
- Mark as unread: `add_label_ids: ["UNREAD"]`
- Archive: `remove_label_ids: ["INBOX"]`
- Star: `add_label_ids: ["STARRED"]`

### list_labels
Get all available labels (system and user-created).

**Required:** none

```json
{
  "action": "list_labels"
}
```

### create_draft
Create a draft email that can be edited or sent later.

**Required:** `to`, `subject`, `body_text` or `body_html`
**Optional:** `cc`, `bcc`, `from_email`, `body_html`, `attachments`, `thread_id`

```json
{
  "action": "create_draft",
  "to": ["client@example.com"],
  "subject": "Proposal Draft",
  "body_html": "<h1>Proposal</h1><p>Here are the details...</p>"
}
```

### send_draft
Send a previously created draft.

**Required:** `draft_id`

```json
{
  "action": "send_draft",
  "draft_id": "r123456789"
}
```

### get_draft
Retrieve the content of a draft.

**Required:** `draft_id`
**Optional:** `format` - `full` (default), `metadata`, `minimal`

```json
{
  "action": "get_draft",
  "draft_id": "r123456789"
}
```

### delete_draft
Permanently delete a draft.

**Required:** `draft_id`

```json
{
  "action": "delete_draft",
  "draft_id": "r123456789"
}
```

### get_profile
Get the authenticated user's Gmail profile including email address and message counts.

**Required:** none

```json
{
  "action": "get_profile"
}
```

## Common Workflows

**Check and read unread emails:**
1. `list_messages` with `q: "is:unread"` to get message IDs
2. `get_message` for each message ID to read content
3. `modify_labels` with `remove_label_ids: ["UNREAD"]` to mark as read

**Send email with review:**
1. `create_draft` to compose the email
2. `get_draft` to review content
3. `send_draft` to send, or `delete_draft` to discard

**Reply to a conversation:**
1. `list_messages` with a search query to find the thread
2. `get_message` to read the message you want to reply to
3. `reply_message` with the message_id and your response

**Organize inbox:**
1. `list_messages` to find messages
2. `list_labels` to see available labels
3. `modify_labels` to apply labels, archive, or star messages

## Important Notes

- **Attachments:** Provide public URLs for file attachments. The files are fetched and attached automatically. Content type is auto-detected if not specified.
- **HTML emails:** You can send both `body_text` and `body_html` together. Recipients who support HTML will see the rich version; others see plain text.
- **Search syntax:** The `q` parameter uses standard Gmail search operators. Combine multiple operators for precise filtering (e.g., `from:alice@example.com newer_than:7d has:attachment`).
- **Pagination:** When `list_messages` returns a `next_page_token`, pass it as `page_token` in the next request to get more results.
- **From address:** The `from_email` field only works if you have configured a send-as alias in Gmail settings.
- **Thread management:** Use `thread_id` with `send_message` or `create_draft` to add a message to an existing conversation thread.

### Frequently Asked Questions

#### How do I connect this tool to an external agent?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

You can install the local MCP server by opening a terminal and running:

```
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

This will connect you to local agents like Claude Code, Windsurf, Grok Build, Cursor, etc.

Alternatively you can connect to the hosted version with this config block, no installation required:

```
{
  "mcpServers": {
    "agentpmt": {
      "type": "streamable-http",
      "url": "https://api.agentpmt.com/mcp",
      "headers": {
        "Authorization": "Bearer <AGENTPMT_BEARER_TOKEN>",
        "x-instance-metadata": "{\"client\":\"generic-mcp\",\"platform\":\"remote\"}"
      }
    }
  }
}
```

[View MCP Connection Instructions](/docs/mcp-reference/connection) for more details.

#### How does an external agent use this tool?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

After the external agent is connected to an Agent Group that can use this tool, paste this prompt into the agent:

> Use the AgentPMT-Tool-Search-and-Execution tool. First call action 'get\_instructions' so you know how to use the tool search interface. Then call action 'get\_schema' with tool\_id 69618e485d4cf4d4b6af40f0 ("Gmail - All Email Actions"). After reading the schema and any returned instructions, tell me what this tool can do, we are going to be using it

The agent should fetch the tool schema first, collect the required parameters for your request, and then call the tool through AgentPMT.

### Dependencies

This product has no public dependency products.