Skip to main content
Glama
Google Workspace MCP Server

Google Workspace MCP Server

by akilja24

send_gmail_message

Sends emails and replies through a user's Gmail account, supporting HTML bodies, CC/BCC, Send As aliases, and attachments via file path or base64 content.

Instructions

Sends an email using the user's Gmail account. Supports both new emails and replies with optional attachments. Supports Gmail's "Send As" feature to send from configured alias addresses.

Args: to (str): Recipient email address. subject (str): Email subject. body (str): Email body content. body_format (Literal['plain', 'html']): Email body format. Defaults to 'plain'. attachments (Optional[List[Dict[str, str]]]): Optional list of attachments. Each dict can contain: Option 1 - File path (auto-encodes): - 'path' (required): File path to attach - 'filename' (optional): Override filename - 'mime_type' (optional): Override MIME type (auto-detected if not provided) Option 2 - Base64 content: - 'content' (required): Standard base64-encoded file content (not urlsafe) - 'filename' (required): Name of the file - 'mime_type' (optional): MIME type (defaults to 'application/octet-stream') cc (Optional[str]): Optional CC email address. bcc (Optional[str]): Optional BCC email address. from_name (Optional[str]): Optional sender display name. If provided, the From header will be formatted as 'Name '. from_email (Optional[str]): Optional 'Send As' alias email address. The alias must be configured in Gmail settings (Settings > Accounts > Send mail as). If not provided, the email will be sent from the authenticated user's primary email address. user_google_email (str): The user's Google email address. Required for authentication. thread_id (Optional[str]): Optional Gmail thread ID to reply within. When provided, sends a reply. in_reply_to (Optional[str]): Optional Message-ID of the message being replied to. Used for proper threading. references (Optional[str]): Optional chain of Message-IDs for proper threading. Should include all previous Message-IDs.

Returns: str: Confirmation message with the sent email's message ID.

Examples: # Send a new email send_gmail_message(to="user@example.com", subject="Hello", body="Hi there!")

# Send with a custom display name
send_gmail_message(to="user@example.com", subject="Hello", body="Hi there!", from_name="John Doe")

# Send an HTML email
send_gmail_message(
    to="user@example.com",
    subject="Hello",
    body="<strong>Hi there!</strong>",
    body_format="html"
)

# Send from a configured alias (Send As)
send_gmail_message(
    to="user@example.com",
    subject="Business Inquiry",
    body="Hello from my business address...",
    from_email="business@mydomain.com"
)

# Send an email with CC and BCC
send_gmail_message(
    to="user@example.com",
    cc="manager@example.com",
    bcc="archive@example.com",
    subject="Project Update",
    body="Here's the latest update..."
)

# Send an email with attachments (using file path)
send_gmail_message(
    to="user@example.com",
    subject="Report",
    body="Please see attached report.",
    attachments=[{
        "path": "/path/to/report.pdf"
    }]
)

# Send an email with attachments (using base64 content)
send_gmail_message(
    to="user@example.com",
    subject="Report",
    body="Please see attached report.",
    attachments=[{
        "filename": "report.pdf",
        "content": "JVBERi0xLjQK...",  # base64 encoded PDF
        "mime_type": "application/pdf"
    }]
)

# Send a reply
send_gmail_message(
    to="user@example.com",
    subject="Re: Meeting tomorrow",
    body="Thanks for the update!",
    thread_id="thread_123",
    in_reply_to="<message123@gmail.com>",
    references="<original@gmail.com> <message123@gmail.com>"
)

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "user_google_email": "<user_google_email>",
      "to": "<to>",
      "subject": "<subject>",
      "body": "<body>"
    },
    "name": "send_gmail_message"
  }
}

Input Schema

NameRequiredDescriptionDefault
ccNoOptional CC email address.
toYesRecipient email address.
bccNoOptional BCC email address.
bodyYesEmail body content (plain text or HTML).
subjectYesEmail subject.
from_nameNoOptional sender display name (e.g., 'Peter Hartree'). If provided, the From header will be formatted as 'Name <email>'.
thread_idNoOptional Gmail thread ID to reply within.
from_emailNoOptional 'Send As' alias email address. Must be configured in Gmail settings (Settings > Accounts > Send mail as). If not provided, uses the authenticated user's email.
referencesNoOptional chain of Message-IDs for proper threading.
attachmentsNoOptional list of attachments. Each can have: "path" (file path, auto-encodes), OR "content" (standard base64, not urlsafe) + "filename". Optional "mime_type". Example: [{"path": "/path/to/file.pdf"}] or [{"filename": "doc.pdf", "content": "base64data", "mime_type": "application/pdf"}]
body_formatNoEmail body format. Use 'plain' for plaintext or 'html' for HTML content.plain
in_reply_toNoOptional Message-ID of the message being replied to.
user_google_emailYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.13.1

TDQS

A3.9/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the full burden, and it does a fair job: it states that user_google_email is "Required for authentication," that Send As aliases must exist in Gmail settings, that base64 must be standard (not urlsafe), and that a confirmation with the sent message ID is returned. It omits anything about irreversibility of sending, rate limits, or failure modes, which matters for a write operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose statement is front-loaded and tight, and the per-argument section is organized. However the nine worked examples are excessive: the HTML, CC/BCC, and display-name cases are largely inferable from the parameter list, and the length pushes the core guidance down. Trimming to three or four representative examples would earn a higher score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter write tool, the definition covers the hard parts well: authentication, alias prerequisites, threading/reply mechanics, and both attachment input formats. Since an output schema exists, the return description can stay brief. Remaining gaps are behavioral edge cases (errors, whether sending is reversible) rather than missing usage information.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 92%, so the schema does most of the work. The description still adds value by spelling out the two mutually exclusive attachment modes with required/optional keys and by demonstrating threading parameters (in_reply_to + references) together in a concrete reply example. This goes modestly beyond restating the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: "Sends an email using the user's Gmail account," and adds the scope that it handles both new emails and replies with attachments. An agent can immediately tell this is the send action rather than a read or draft tool. It does not, however, name the sibling draft/compose alternatives, so differentiation relies on the agent's own inference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is clear conditional guidance: thread_id "When provided, sends a reply," from_email requires the alias to be pre-configured in Gmail settings, and attachments can be supplied either by path or base64 content. These conditions tell an agent how to switch modes. What's missing is any exclusion telling the agent when NOT to use this tool, e.g. to compose without sending (draft_gmail_message).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools