Skip to main content
Glama
beylessai

Hiworks Mail MCP

read_email

Retrieve email content from Hiworks Mail by specifying a message ID to access text, HTML, and attachments.

Instructions

하이웍스 이메일을 읽어옵니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
usernameNo
passwordNo
messageIdYes

Implementation Reference

  • The handler function for the 'read_email' tool. It connects to the POP3 server using the provided credentials, iterates through emails to find the one matching the messageId, parses the email content with mailparser, converts date to KST, and returns the structured email data or error.
    async ({ username, password, messageId }) => {
      try {
        const client = await connectPOP3(username, password);
        const stat = await client.STAT();
        const totalMessages = stat[0];
        let email: Email | undefined;
    
        for (let i = totalMessages; i >= 1; i--) {
          try {
            const rawEmail = await client.RETR(i);
            const parsed = await simpleParser(rawEmail);
            
            if (parsed.messageId === messageId || String(i) === messageId) {
              // KST로 변환된 날짜 사용
              const date = parsed.date ? formatDate(parsed.date) : formatDate(new Date());
              
              email = {
                id: parsed.messageId || String(i),
                subject: parsed.subject || '(제목 없음)',
                from: Array.isArray(parsed.from) ? parsed.from[0]?.text || '' : parsed.from?.text || '',
                to: Array.isArray(parsed.to) ? parsed.to[0]?.text || '' : parsed.to?.text || '',
                date,
                content: parsed.text || '',
                html: parsed.html || undefined
              };
              break;
            }
          } catch (err) {
            log(`Error processing email ${i}:`, err);
            continue;
          }
        }
    
        await client.QUIT();
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: true,
                email
              } as ReadEmailResponse)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                success: false,
                error: error.message
              } as ReadEmailResponse)
            }
          ]
        };
      }
    }
  • src/index.ts:241-305 (registration)
    The server.tool call that registers the 'read_email' tool with its description, input schema (readEmailSchema), and handler function.
    server.tool(
      'read_email',
      '하이웍스 이메일을 읽어옵니다.',
      readEmailSchema,
      async ({ username, password, messageId }) => {
        try {
          const client = await connectPOP3(username, password);
          const stat = await client.STAT();
          const totalMessages = stat[0];
          let email: Email | undefined;
    
          for (let i = totalMessages; i >= 1; i--) {
            try {
              const rawEmail = await client.RETR(i);
              const parsed = await simpleParser(rawEmail);
              
              if (parsed.messageId === messageId || String(i) === messageId) {
                // KST로 변환된 날짜 사용
                const date = parsed.date ? formatDate(parsed.date) : formatDate(new Date());
                
                email = {
                  id: parsed.messageId || String(i),
                  subject: parsed.subject || '(제목 없음)',
                  from: Array.isArray(parsed.from) ? parsed.from[0]?.text || '' : parsed.from?.text || '',
                  to: Array.isArray(parsed.to) ? parsed.to[0]?.text || '' : parsed.to?.text || '',
                  date,
                  content: parsed.text || '',
                  html: parsed.html || undefined
                };
                break;
              }
            } catch (err) {
              log(`Error processing email ${i}:`, err);
              continue;
            }
          }
    
          await client.QUIT();
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  success: true,
                  email
                } as ReadEmailResponse)
              }
            ]
          };
        } catch (error: any) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  success: false,
                  error: error.message
                } as ReadEmailResponse)
              }
            ]
          };
        }
      }
    );
  • Zod validation schema for read_email input parameters, extending emailSchema (username, password) with required messageId.
    const readEmailSchema = {
      ...emailSchema,
      messageId: z.string()
    };
  • TypeScript interface defining the input parameters for the read_email tool.
    export interface ReadEmailParams {
      username?: string;
      password?: string;
      messageId: string;
    }
  • TypeScript interface defining the output response structure for the read_email tool.
    export interface ReadEmailResponse {
      success: boolean;
      email?: Email;
      error?: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action ('read') but doesn't disclose behavioral traits such as authentication needs (implied by username/password parameters), rate limits, error handling, or what 'read' returns (e.g., full email content). This leaves significant gaps for a tool with authentication parameters.

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 a single, efficient sentence in Korean with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word contributes to stating the purpose without redundancy.

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 complexity (3 parameters, authentication, no output schema, and no annotations), the description is incomplete. It doesn't cover parameter meanings, return values, or behavioral context. For a tool that likely involves sensitive data (email) and authentication, more detail is needed to be fully usable by an AI agent.

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. It doesn't mention any parameters, leaving all three (username, password, messageId) undocumented. The description adds no meaning beyond the schema, failing to explain what 'messageId' refers to or why authentication is needed, which is critical given the low coverage.

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 '하이웍스 이메일을 읽어옵니다' (Reads Hiworks email) states a clear verb ('read') and resource ('Hiworks email'), but it's vague about scope and doesn't distinguish from sibling tools like 'search_email'. It specifies the service (Hiworks) but lacks detail on what 'read' entails (e.g., fetching a single email vs. listing).

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 like 'search_email' or 'send_email'. The description implies it's for reading emails, but doesn't specify scenarios (e.g., for a specific message ID) or exclusions. Usage is implied from the name and context, but no practical advice is provided.

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/beylessai/hiworks-mcp'

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