Skip to main content
Glama
debanshd

Tavily Web Search MCP Server

by debanshd

send_gmail

Send emails via Gmail API to recipients with subject and body content. Integrates with Tavily Web Search MCP Server for email functionality.

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-63 (handler)
    The complete implementation of the 'send_gmail' tool, including @mcp.tool() registration decorator and the handler function that sends emails using Gmail SMTP with smtplib. The schema is inferred from the function signature (to: str, subject: str, body: str) -> 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