Skip to main content
Glama
MrNewDelhi

Mailosaur MCP

by MrNewDelhi

mailosaur_files_get_preview

Download an email preview screenshot as base64 content. Provide the preview ID to retrieve the image.

Instructions

Download a generated email preview screenshot. Returns base64 content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
previewIdYes

Implementation Reference

  • src/index.ts:370-384 (registration)
    Registration of the 'mailosaur_files_get_preview' tool via server.tool() with the MCP server, including its description, schema (expects previewId string), and handler logic.
    server.tool(
      "mailosaur_files_get_preview",
      "Download a generated email preview screenshot. Returns base64 content.",
      {
        previewId: z.string()
      },
      async ({ previewId }) => {
        const file = await mailosaur.files.getPreview(previewId);
        return response({
          previewId,
          encoding: "base64",
          content: await toBase64(file)
        });
      }
    );
  • Handler function for the tool: calls mailosaur.files.getPreview(previewId), converts the result to base64 via toBase64(), and returns a response with previewId, encoding, and content.
    async ({ previewId }) => {
      const file = await mailosaur.files.getPreview(previewId);
      return response({
        previewId,
        encoding: "base64",
        content: await toBase64(file)
      });
    }
  • Input schema for the tool: requires a single 'previewId' string parameter validated by zod.
    {
      previewId: z.string()
    },
  • Helper function 'toBase64' used by the handler to convert the file/stream response into a base64-encoded 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");
      }
      return Buffer.from(JSON.stringify(file)).toString("base64");
    }
  • Helper function 'response' that wraps a value into the MCP content response format (text content type with JSON stringified value).
    function response(value: unknown) {
      return {
        content: [
          {
            type: "text" as const,
            text: JSON.stringify(value, null, 2)
          }
        ]
      };
    }
Behavior2/5

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

With no annotations, the description carries full responsibility. It mentions returning base64 content but lacks details on safety, authentication, error behavior, or what happens with invalid previewId. The read-only nature is implied but not explicit.

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?

Two short sentences, no redundant words, and the action verb is front-loaded. Every sentence earns its place.

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?

The description omits prerequisites (e.g., generating a preview first) and does not specify the image type or other output details. For a tool with one parameter and no output schema, more context is needed for effective use.

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. However, it does not explain what previewId is or how to obtain it (e.g., from preview generation). It adds no meaning beyond the schema's property name.

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

Purpose5/5

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

The description clearly states the tool downloads a generated email preview screenshot and returns base64 content. It uses a specific verb and resource, distinguishing it from siblings like mailosaur_files_get_attachment and mailosaur_files_get_email.

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 explicit guidance on when to use this tool versus alternatives, such as when to download a preview versus an attachment or email. No prerequisites mentioned, like the need to generate a preview first with mailosaur_messages_generate_previews.

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