Skip to main content
Glama

send_email

Initiate email delivery directly via Google Toolbox by specifying recipient, subject, body, CC, and BCC fields for precise communication.

Instructions

Send a new email

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bccNo
bodyYes
ccNo
subjectYes
toYes

Implementation Reference

  • The main handler function for the 'send_email' tool. It uses the Gmail API to send an email with the provided recipient, subject, body, and optional CC/BCC fields. Returns success message with message ID or error.
    async def send_email(to: EmailStr, subject: str, body: str, cc: Optional[EmailStr] = None, bcc: Optional[EmailStr] = None) -> str:
        """
        Send a new email
        
        Args:
            to (str): Recipient email address
            subject (str): Email subject
            body (str): Email body (can include HTML)
            cc (str, optional): CC recipient email address (comma-separated)
            bcc (str, optional): BCC recipient email address (comma-separated)
        
        Returns:
            str: Success message
        """
        creds = get_google_credentials()
        if not creds:
            return "Google authentication failed."
    
        try:
            service = build('gmail', 'v1', credentials=creds)
            message = MIMEText(body)
            message['to'] = to
            message['subject'] = subject
            if cc:
                message['cc'] = cc
            if bcc:
                message['bcc'] = bcc
    
            encoded_message = base64.urlsafe_b64encode(message.as_bytes()).decode()
            create_message = {'raw': encoded_message}
    
            send_message = service.users().messages().send(userId='me', body=create_message).execute()
            logger.info(f"메시지 ID: {send_message['id']} 발송 완료.")
            return f"이메일 발송 성공. 메시지 ID: {send_message['id']}"
    
        except HttpError as error:
            logger.error(f"API 오류 발생: {error}")
            return f"Gmail API 오류: {error.resp.status} - {error.content.decode()}"
        except Exception as e:
            logger.exception("이메일 발송 중 오류:")
            return f"예상치 못한 오류 발생: {str(e)}"
  • server.py:317-320 (registration)
    The @mcp.tool decorator that registers the send_email function as an MCP tool with the specified name and description. The input schema is inferred from the function's type annotations (EmailStr, str, Optional[EmailStr]).
    @mcp.tool(
        name="send_email",
        description="Send a new email",
    )
  • The send_email tool is listed in the available_google_tools resource, which provides a list of all available tools on the server.
    available_google_tools = [
        "list_emails", "search_emails", "send_email", "modify_email",
        "list_events", "create_event", "update_event", "delete_event",
        "search_google", "read_gdrive_file", "search_gdrive"
    ]
    logger.info(f"Resource 'get_available_google_tools' 호출됨. 반환: {available_google_tools}")
    return available_google_tools
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a write operation (sending) but does not disclose permissions needed, rate limits, delivery confirmation, or error handling. This is inadequate for a mutation tool with zero annotation coverage.

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

Conciseness5/5

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

The description is extremely concise with a single sentence, 'Send a new email,' which is front-loaded and wastes no words. However, this conciseness comes at the cost of completeness, as it under-specifies critical details.

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

Completeness2/5

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

For a 5-parameter mutation tool with no annotations and no output schema, the description is incomplete. It fails to address behavioral aspects, parameter meanings, or usage context, making it insufficient for reliable agent operation despite the simple action implied.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but adds no parameter details. It does not explain the purpose of fields like bcc or cc, expected formats, or constraints beyond what the schema titles imply. This leaves significant gaps in understanding the 5 parameters.

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

Purpose3/5

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

The description 'Send a new email' clearly states the action (send) and resource (email), distinguishing it from siblings like list_emails or modify_email. However, it lacks specificity about what constitutes 'new' versus existing emails, making it somewhat vague compared to more precise alternatives.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like modify_email or search_emails. The description does not mention prerequisites, context, or exclusions, leaving the agent to infer usage based on tool names alone.

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

Install Server

Other Tools

Related Tools

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/jikime/py-mcp-google-toolbox'

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