Skip to main content
Glama

get_latest_email

Retrieve the most recent full email from a temporary inbox to access verification codes and confirmation links without manual intervention.

Instructions

Read and return the latest full email in an inbox.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inbox_idYes
mark_as_readNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core logic for the get_latest_email tool, which fetches and reads the latest email from an inbox.
    async def run(
        api: ApiClient,
        inbox_id: str,
        mark_as_read: bool = False,
    ) -> dict[str, Any]:
        if not inbox_id:
            return tool_error("validation_error", 400, "inbox_id is required")
    
        try:
            messages = await api.list_messages(inbox_id, limit=1, offset=0)
        except ApiClientError as exc:
            return exc.to_dict()
    
        if not messages:
            return tool_error("no_messages", 404, "No messages found for inbox")
    
        latest = messages[0]
        message_id = str(latest.get("id") or "")
        if not message_id:
            return tool_error("invalid_response", 502, "Missing message id in API response")
    
        try:
            full_message = await api.read_message(inbox_id, message_id)
        except ApiClientError as exc:
            return exc.to_dict()
    
        return {
            "message_id": str(full_message.get("id") or message_id),
            "subject": full_message.get("subject"),
            "from_address": full_message.get("from_address"),
            "received_at": full_message.get("received_at"),
            "body_text": full_message.get("body_text"),
            "body_html": full_message.get("body_html"),
            "has_attachments": bool(full_message.get("attachments")),
            # API read_message marks messages as read; this side effect is always true.
            "marked_as_read": True,
            "mark_as_read_requested": mark_as_read,
        }
  • The registration of the get_latest_email tool in the MCP server, which wraps the execution logic.
    @mcp.tool(description="Read and return the latest full email in an inbox.")
    async def get_latest_email(
        inbox_id: str,
        mark_as_read: bool = False,
    ) -> dict[str, Any]:
        api_key = _get_api_key()
        if not api_key:
            return _unauthorized()
        try:
            async with ApiClient(api_key=api_key) as api:
                return await get_latest_email_tool.run(
                    api=api,
                    inbox_id=inbox_id,
Behavior2/5

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

With no annotations provided, the description carries the full burden. While 'Read' implies a fetch operation, the description fails to disclose the side effect of the mark_as_read parameter (which can modify inbox state) or explain error conditions (e.g., empty inbox).

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

Conciseness4/5

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

The single sentence is front-loaded with the core action and contains no redundancy. However, given the lack of schema descriptions and annotations, the extreme brevity results in under-specification rather than efficient conciseness.

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

Completeness3/5

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

Adequate for a simple read operation with an output schema present (which handles return value documentation). However, the lack of parameter documentation, behavioral side effects, and differentiation from extraction siblings leaves noticeable gaps.

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%, requiring the description to compensate. It provides minimal context for inbox_id via 'in an inbox', but offers no explanation for mark_as_read (including its default false value and side effects) or inbox_id format expectations.

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

Purpose4/5

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

The description clearly states the action ('Read and return') and resource ('latest full email'), with 'full' usefully distinguishing it from sibling extraction tools like extract_otp_code. However, it does not explicitly name alternatives or clarify when to prefer this over specialized extraction tools.

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 siblings (e.g., when to use get_latest_email vs extract_otp_code vs wait_for_verification_email). No prerequisites or exclusions are mentioned.

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

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/francofuji/un-correo-temporal'

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