Skip to main content
Glama
debanshd

Tavily Web Search MCP Server

by debanshd

send_gmail

Send emails directly from the Tavily Web Search MCP Server using the Gmail API. Configure environment variables to authenticate and compose messages with recipient, subject, and body content.

Instructions

Send an email using Gmail API. Requires GMAIL_USER and GMAIL_APP_PASSWORD environment variables.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYes
subjectYes
bodyYes

Implementation Reference

  • server.py:28-64 (handler)
    Implementation of the send_gmail tool handler. Decorated with @mcp.tool() which also registers it. Sends email via Gmail SMTP using smtplib, with input schema defined by function parameters (to: str, subject: str, body: str).
    @mcp.tool() def send_gmail(to: str, subject: str, body: str) -> str: """Send an email using Gmail API. Requires GMAIL_USER and GMAIL_APP_PASSWORD environment variables.""" try: import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart # Get Gmail credentials from environment variables gmail_user = os.getenv("GMAIL_USER") gmail_password = os.getenv("GMAIL_APP_PASSWORD") if not gmail_user or not gmail_password: return "❌ Gmail credentials not configured. Please set GMAIL_USER and GMAIL_APP_PASSWORD environment variables." # Create message msg = MIMEMultipart() msg['From'] = gmail_user msg['To'] = to msg['Subject'] = subject # Add body to email msg.attach(MIMEText(body, 'plain')) # Send email server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login(gmail_user, gmail_password) text = msg.as_string() server.sendmail(gmail_user, to, text) server.quit() return f"✅ Email sent successfully to {to} with subject: {subject}" except Exception as e: return f"❌ Failed to send email: {str(e)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/debanshd/AIE7-MCP-Session'

If you have feedback or need assistance with the MCP directory API, please join our Discord server