Skip to content

Email Tools

Email and search tools for reading, searching, and managing emails.

Cache-First Performance

Read operations query the local SQLite cache first, providing sub-millisecond response times. The cache syncs with Gmail IMAP every 5 minutes automatically.

Search emails using Gmail-style query syntax.

Parameters:

ParameterTypeRequiredDescription
querystringYesSearch query (Gmail syntax)
max_resultsnumberNoMax results (default: 50)

Query Syntax Examples:

from:boss@company.com
subject:invoice
has:attachment
after:2026-01-01 before:2026-01-31
from:vip@company.com is:unread

Returns:

json
{
  "results": [
    {
      "uid": 12345,
      "thread_id": "thread_abc",
      "subject": "Q1 Budget Review",
      "from": "boss@company.com",
      "date": "2026-01-08T14:30:00Z",
      "snippet": "Please review the attached budget..."
    }
  ]
}

Classification: Read-only ✅

search_emails

Search emails using structured criteria with database queries.

Parameters:

ParameterTypeRequiredDescription
folderstringNoFolder to search in (default: "INBOX")
from_addrstringNoFilter by sender address (partial match)
to_addrstringNoFilter by recipient address (partial match)
subjectstringNoFilter by subject (partial match)
bodystringNoFilter by body content (partial match)
unread_onlybooleanNoOnly return unread emails (default: false)
limitnumberNoMax results (default: 50)

Returns: Array of email objects with uid, subject, from, date, snippet

Classification: Read-only ✅

Example:

json
{
  "folder": "INBOX",
  "from_addr": "boss",
  "unread_only": true,
  "limit": 10
}

Response:

json
[
  {
    "uid": 12345,
    "subject": "Q1 Budget Review",
    "from": "boss@company.com",
    "date": "2026-01-08T14:30:00Z",
    "snippet": "Please review the attached budget...",
    "is_unread": true,
    "flags": ["\\Seen"]
  }
]

get_unread_messages

Fetch recent unread emails with basic metadata.

Parameters:

ParameterTypeRequiredDescription
limitnumberNoMax emails (default: 20)

Returns:

json
{
  "messages": [
    {
      "uid": 12345,
      "subject": "Meeting Tomorrow",
      "from": "colleague@company.com",
      "date": "2026-01-09T09:00:00Z",
      "snippet": "Hi, can we meet at 3pm..."
    }
  ],
  "total_unread": 15
}

Classification: Read-only ✅

get_email_details

Get full email content including attachments metadata.

Parameters:

ParameterTypeRequiredDescription
uidnumberYesEmail UID
folderstringNoFolder name (default: INBOX)

Returns:

json
{
  "uid": 12345,
  "subject": "Q1 Report",
  "from": "reports@company.com",
  "to": ["you@gmail.com"],
  "cc": ["team@company.com"],
  "date": "2026-01-09T10:00:00Z",
  "body": "Full email body text...",
  "attachments": [
    {
      "filename": "Q1-Report.pdf",
      "size": 245678,
      "content_type": "application/pdf",
      "attachment_id": "att_abc123"
    }
  ]
}

Classification: Read-only ✅

gmail_get_thread / get_thread

Retrieve entire conversation thread.

Parameters:

ParameterTypeRequiredDescription
thread_idstringYesThread ID from search results

Returns:

json
{
  "thread_id": "thread_abc",
  "subject": "Re: Project Update",
  "messages": [
    {
      "uid": 12340,
      "from": "colleague@company.com",
      "to": ["you@gmail.com"],
      "date": "2026-01-07T14:00:00Z",
      "body": "Here's the initial update..."
    },
    {
      "uid": 12345,
      "from": "you@gmail.com",
      "to": ["colleague@company.com"],
      "date": "2026-01-08T09:30:00Z",
      "body": "Thanks, I'll review..."
    }
  ]
}

Classification: Read-only ✅

summarize_thread

Get a token-efficient summary of an email thread for AI context.

Parameters:

ParameterTypeRequiredDescription
thread_idstringYesThread ID

Returns:

json
{
  "thread_id": "thread_abc",
  "participants": ["you@gmail.com", "colleague@company.com"],
  "message_count": 5,
  "date_range": "Jan 7-9, 2026",
  "key_points": [
    "Project timeline discussed",
    "Budget approval pending",
    "Next meeting scheduled for Friday"
  ],
  "latest_message": {
    "from": "colleague@company.com",
    "date": "2026-01-09T10:00:00Z",
    "snippet": "Sounds good, see you Friday..."
  }
}

Classification: Read-only ✅

send_email

Send an email message.

Mutation Tool

Always show draft to user before calling. See AGENTS.md for the draft-review-send pattern.

Parameters:

ParameterTypeRequiredDescription
tostringYesRecipient email
subjectstringYesEmail subject
bodystringYesEmail body (plain text or HTML)
ccstringNoCC recipients (comma-separated)
bccstringNoBCC recipients
reply_to_message_idstringNoMessage ID for threading

Classification: Mutation 🔴 (requires user confirmation)

create_draft_reply

Create a draft reply in Gmail Drafts folder.

Parameters:

ParameterTypeRequiredDescription
uidnumberYesOriginal email UID
folderstringYesFolder containing original email
reply_bodystringYesDraft reply body content
reply_allbooleanNoReply to all recipients (default: false)

Returns:

json
{
  "status": "success",
  "message": "Draft created",
  "draft_uid": "draft_xyz",
  "draft_folder": "[Gmail]/Drafts"
}

Classification: Staging ✅ (safe - creates draft, doesn't send)

Example:

json
{
  "uid": 12345,
  "folder": "INBOX",
  "reply_body": "Thanks for your email. I'll review and get back to you.",
  "reply_all": false
}

mark_as_read / mark_as_unread

Change email read status.

Parameters:

ParameterTypeRequiredDescription
uidnumberYesEmail UID
folderstringNoFolder name (default: INBOX)

Classification: Mutation 🔴 (confirm for bulk operations)

move_email

Move email to different folder.

Parameters:

ParameterTypeRequiredDescription
uidnumberYesEmail UID
destinationstringYesTarget folder name
sourcestringNoSource folder (default: INBOX)

Classification: Mutation 🔴 (requires confirmation)

modify_gmail_labels

Add or remove Gmail labels.

Parameters:

ParameterTypeRequiredDescription
uidnumberYesEmail UID
add_labelsarrayNoLabels to add
remove_labelsarrayNoLabels to remove

Classification: Mutation 🔴 (requires confirmation)

list_folders

List all synced email folders and their status.

Parameters: None

Returns:

json
[
  {
    "name": "INBOX",
    "message_count": 150,
    "unread_count": 5,
    "sync_status": "synced"
  }
]

Classification: Read-only ✅


trigger_sync

Trigger an immediate email synchronization with the mail server.

Parameters: None

Returns:

json
{
  "status": "success",
  "message": "Sync triggered"
}

Classification: Read-only ✅


process_email

Perform a generic action on an email (move, mark read/unread, delete).

Parameters:

ParameterTypeRequiredDescription
uidnumberYesEmail UID
folderstringYesSource folder
actionstringYesAction: "move", "read", "unread", "delete"
target_folderstringNoTarget folder for "move" action

Example:

json
{
  "uid": 12345,
  "folder": "INBOX",
  "action": "move",
  "target_folder": "Projects"
}

Classification: Mutation 🔴 (requires confirmation)


Semantic Search Tools

Available when PostgreSQL + pgvector is configured:

semantic_search_emails

Search emails by meaning, not keywords.

Parameters:

ParameterTypeRequiredDescription
querystringYesNatural language search
folderstringNoFolder to search (default: INBOX)
limitnumberNoMax results (default: 20)
similarity_thresholdfloatNoMin similarity 0-1 (default: 0.7)

Example queries:

  • "emails about budget concerns"
  • "discussions about project delays"
  • "messages asking for my opinion"

Classification: Read-only ✅

Find emails similar to a reference email.

Parameters:

ParameterTypeRequiredDescription
uidnumberYesReference email UID
folderstringNoFolder (default: INBOX)
limitnumberNoMax results (default: 10)

Use case: Gather context before drafting a reply.

Classification: Read-only ✅

semantic_search_filtered

Combine hard filters with semantic similarity for precise search.

Why use this? Regular semantic search can find semantically similar emails from wrong senders or date ranges. This tool applies hard filters FIRST, then ranks results by semantic similarity.

Parameters:

ParameterTypeRequiredDescription
querystringYesNatural language query
folderstringNoFolder to search (default: INBOX)
from_addrstringNoFilter by sender (partial match)
to_addrstringNoFilter by recipient (partial match)
date_fromstringNoFilter emails on/after (YYYY-MM-DD)
date_tostringNoFilter emails on/before (YYYY-MM-DD)
has_attachmentsbooleanNoFilter by attachment presence
limitnumberNoMax results (default: 20)

Example:

json
{
  "query": "budget concerns",
  "from_addr": "finance",
  "date_from": "2026-01-01",
  "has_attachments": true
}

Classification: Read-only ✅


Next: Calendar Tools | Intelligence Tools

Released under the MIT License.