Skip to main content
Glama
MrNewDelhi

Mailosaur MCP

by MrNewDelhi

mailosaur_files_get_email

Download an email message as an EML file encoded in base64 for offline access or raw content analysis.

Instructions

Download a message as an EML file. Returns base64 content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageIdYes

Implementation Reference

  • src/index.ts:337-352 (registration)
    Registration of the 'mailosaur_files_get_email' tool via server.tool(), which defines its name, description, schema, and handler.
    server.tool(
      "mailosaur_files_get_email",
      "Download a message as an EML file. Returns base64 content.",
      {
        messageId: z.string()
      },
      async ({ messageId }) => {
        const file = await mailosaur.files.getEmail(messageId);
        return response({
          messageId,
          contentType: "message/rfc822",
          encoding: "base64",
          content: await toBase64(file)
        });
      }
    );
  • Input schema for the tool: requires a single 'messageId' field (z.string()).
    {
      messageId: z.string()
    },
  • Handler function that calls mailosaur.files.getEmail(messageId) and returns the result as base64 content with contentType 'message/rfc822'.
    async ({ messageId }) => {
      const file = await mailosaur.files.getEmail(messageId);
      return response({
        messageId,
        contentType: "message/rfc822",
        encoding: "base64",
        content: await toBase64(file)
      });
    }
  • The 'response()' helper used to format the tool's return value as JSON text content.
    function response(value: unknown) {
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(value, null, 2)
          }
        ]
      };
    }
  • The 'toBase64()' helper that converts a Readable stream, Buffer, Uint8Array, or string to a base64 string.
    async function toBase64(file: unknown) {
      if (file instanceof Readable) {
        const chunks: Buffer[] = [];
        for await (const chunk of file) {
          chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
        }
        return Buffer.concat(chunks).toString("base64");
      }
      if (Buffer.isBuffer(file)) return file.toString("base64");
      if (file instanceof Uint8Array) return Buffer.from(file).toString("base64");
      if (typeof file === "string") return Buffer.from(file).toString("base64");
      if (file && typeof file === "object" && "content" in file) {
        const content = (file as { content: unknown }).content;
        if (Buffer.isBuffer(content)) return content.toString("base64");
        if (content instanceof Uint8Array) return Buffer.from(content).toString("base64");
        if (typeof content === "string") return Buffer.from(content).toString("base64");
Behavior2/5

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

With no annotations, the description carries full burden. It mentions returning base64 content but does not disclose authentication needs, rate limits, error cases, or implications of accessing invalid message IDs.

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 at two sentences, front-loading the core action and output format with no unnecessary words.

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?

Given the lack of output schema and annotations, the description is insufficient. It does not specify return structure beyond 'base64 content', nor does it address how to handle the file or any prerequisites.

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 coverage is 0% (description does not describe parameters). The single parameter messageId is not explained (e.g., what it represents, how to obtain it). The description adds no semantic value beyond the schema.

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 'Download a message as an EML file', specifying the verb and resource. It differentiates from siblings like get_attachment and get_preview by focusing on the full message download, though it could be slightly more specific.

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?

The description does not provide any guidance on when to use this tool versus alternatives (e.g., mailosaur_messages_get for non-file access, mailosaur_files_get_attachment for attachments). It lacks context for tool selection.

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/MrNewDelhi/mailosaur-mcp'

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