Provides LLM agents with functions to read, search, draft, and send Gmail messages via the Gmail API.
# Source: https://github.com/mperkins0155/llama-hub | License: MIT | Copyright Jerry Liu
# Provided via justclaw.it.com; keep this notice with the code.
"""GMail tool spec."""
import base64
import email
from email.message import EmailMessage
from typing import Any, List, Optional
from llama_index.readers.schema.base import Document
from llama_index.tools.tool_spec.base import BaseToolSpec
SCOPES = [
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.readonly",
]
class GmailToolSpec(BaseToolSpec):
"""GMail tool spec.
Gives the agent the ability to read, draft and send gmail messages
"""
spec_functions = [
"load_data",
"search_messages",
"create_draft",
"update_draft",
"get_draft",
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key