Skip to main content
Glama
sugar-crash-studios

Proton MCP Server

Read Full Email

proton_read_email
Read-onlyIdempotent

Read full email content from Proton Mail, including headers, body, and attachments, by specifying folder and email UID.

Instructions

Read the complete content of an email, including headers, body, and attachments. Specify folder and email UID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
folderNoINBOX
uidYes

Implementation Reference

  • The async callback function containing the implementation logic for the 'proton_read_email' tool, which fetches and formats email data.
      async (params: z.infer<typeof ReadEmailSchema>) => {
        try {
          const message = await fetchMessage(params.folder, params.uid);
    
          // Format email content
          let result = `**From:** ${message.from.name || message.from.email} <${message.from.email}>\n`;
          
          if (message.to && message.to.length > 0) {
            const toList = message.to
              .map(t => `${t.name || t.email} <${t.email}>`)
              .join(', ');
            result += `**To:** ${toList}\n`;
          }
    
          if (message.cc && message.cc.length > 0) {
            const ccList = message.cc
              .map(c => `${c.name || c.email} <${c.email}>`)
              .join(', ');
            result += `**CC:** ${ccList}\n`;
          }
    
          result += `**Subject:** ${message.subject}\n`;
          result += `**Date:** ${message.date.toISOString()}\n`;
    
          if (message.messageId) {
            result += `**Message-ID:** ${message.messageId}\n`;
          }
    
          if (message.inReplyTo) {
            result += `**In-Reply-To:** ${message.inReplyTo}\n`;
          }
    
          result += '\n---\n\n';
    
          // Add body
          if (message.textBody) {
            result += message.textBody;
          } else if (message.htmlBody) {
            result += `[HTML Body]\n${message.htmlBody}`;
          } else {
            result += '[No message body]';
          }
    
          // Add attachments section
          if (message.attachments && message.attachments.length > 0) {
            result += '\n\n---\n\n**Attachments:**\n';
            for (const attachment of message.attachments) {
              const size = formatBytes(attachment.size);
              result += `- ${attachment.filename} (${attachment.contentType}, ${size})\n`;
            }
          }
    
          return {
            content: [
              {
                type: 'text',
                text: result,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text',
                text: `Error reading email: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Registration function that registers the 'proton_read_email' tool with the MCP server.
    export function registerReadEmailTool(server: McpServer) {
      server.registerTool(
        'proton_read_email',
        {
          title: 'Read Full Email',
          description: 'Read the complete content of an email, including headers, body, and attachments. Specify folder and email UID.',
          inputSchema: ReadEmailSchema,
          annotations: {
            readOnlyHint: true,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: false,
          },
        },
        async (params: z.infer<typeof ReadEmailSchema>) => {
          try {
            const message = await fetchMessage(params.folder, params.uid);
    
            // Format email content
            let result = `**From:** ${message.from.name || message.from.email} <${message.from.email}>\n`;
            
            if (message.to && message.to.length > 0) {
              const toList = message.to
                .map(t => `${t.name || t.email} <${t.email}>`)
                .join(', ');
              result += `**To:** ${toList}\n`;
            }
    
            if (message.cc && message.cc.length > 0) {
              const ccList = message.cc
                .map(c => `${c.name || c.email} <${c.email}>`)
                .join(', ');
              result += `**CC:** ${ccList}\n`;
            }
    
            result += `**Subject:** ${message.subject}\n`;
            result += `**Date:** ${message.date.toISOString()}\n`;
    
            if (message.messageId) {
              result += `**Message-ID:** ${message.messageId}\n`;
            }
    
            if (message.inReplyTo) {
              result += `**In-Reply-To:** ${message.inReplyTo}\n`;
            }
    
            result += '\n---\n\n';
    
            // Add body
            if (message.textBody) {
              result += message.textBody;
            } else if (message.htmlBody) {
              result += `[HTML Body]\n${message.htmlBody}`;
            } else {
              result += '[No message body]';
            }
    
            // Add attachments section
            if (message.attachments && message.attachments.length > 0) {
              result += '\n\n---\n\n**Attachments:**\n';
              for (const attachment of message.attachments) {
                const size = formatBytes(attachment.size);
                result += `- ${attachment.filename} (${attachment.contentType}, ${size})\n`;
              }
            }
    
            return {
              content: [
                {
                  type: 'text',
                  text: result,
                },
              ],
            };
          } catch (error) {
            return {
              content: [
                {
                  type: 'text',
                  text: `Error reading email: ${error instanceof Error ? error.message : String(error)}`,
                },
              ],
            };
          }
        }
      );
    }
Behavior4/5

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

Annotations already indicate read-only, non-destructive, and idempotent behavior, which the description does not contradict. The description adds useful context by specifying what content is read (headers, body, attachments) and mentioning folder and UID parameters, enhancing transparency beyond the annotations without providing extra details like rate limits or auth needs.

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 front-loaded with the core purpose in the first clause and efficiently specifies content and parameters in a single, waste-free sentence. Every element earns its place, making it highly concise and well-structured for quick understanding.

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

Completeness4/5

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

Given the tool's moderate complexity (2 parameters, no output schema), the description covers the purpose and parameters adequately. It lacks details on return values or error handling, but with annotations providing safety context, it is mostly complete. A higher score would require more behavioral or output information.

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

Parameters3/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. It mentions the parameters (folder and email UID) but does not add meaning beyond the schema, such as explaining folder options or UID significance. With no param details in the description, it partially compensates but leaves semantics unclear, aligning with the baseline for low coverage.

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 specific action ('Read the complete content of an email') and resource ('email'), distinguishing it from siblings like proton_list_emails (list) or proton_delete_email (delete). It explicitly mentions what content is included (headers, body, attachments), making the purpose unambiguous and distinct.

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

Usage Guidelines4/5

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

The description provides clear context by specifying that it reads a full email, implying it should be used when detailed content is needed versus proton_list_emails for summaries. However, it does not explicitly state when not to use it or name alternatives, such as proton_search_emails for filtered searches, leaving some guidance implicit.

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/sugar-crash-studios/proton-mcp-server'

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