Skip to main content
Glama
jhw7500

Email MCP Server

by jhw7500

fetch_email_thread

Retrieve email conversation threads by searching subject keywords across recent messages to restore complete discussions.

Instructions

제목 키워드로 이메일 스레드(대화)를 복원합니다. 최근 100건에서 검색합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subject_keywordYes제목에 포함된 키워드

Implementation Reference

  • The implementation of the `fetch_email_thread` tool logic, which retrieves and sorts emails matching a subject keyword.
    case "fetch_email_thread": {
      if (!args.subject_keyword || typeof args.subject_keyword !== "string") {
        return { content: [{ type: "text" as const, text: "오류: subject_keyword는 필수 문자열 파라미터입니다." }], isError: true };
      }
      const keyword = args.subject_keyword.toLowerCase();
      const emails = await withConnection(config, async (client) => {
        const headers = await client.list(100);
        const matched = headers.filter((h) =>
          h.subject.toLowerCase().includes(keyword)
        );
        const results = [];
        for (const h of matched) {
          try {
            results.push(await client.getEmail(h.id));
          } catch { /* skip */ }
        }
        return results.sort(
          (a, b) => new Date(a.date).getTime() - new Date(b.date).getTime()
        );
      });
    
      if (emails.length === 0) {
        return {
          content: [{ type: "text" as const, text: `"${args.subject_keyword}" 관련 스레드를 찾을 수 없습니다.` }],
        };
      }
    
      const text = emails
        .map(
          (e) =>
            `### ${e.subject}\n` +
            `From: ${e.from} | ${e.date ? new Date(e.date).toLocaleString("ko-KR") : ""}\n\n` +
            `${e.body}`
        )
        .join("\n\n---\n\n");
    
      return {
        content: [{ type: "text" as const, text: `스레드 (${emails.length}건):\n\n${text}` }],
      };
    }
  • The definition and schema for `fetch_email_thread` tool.
    {
      name: "fetch_email_thread",
      description: "제목 키워드로 이메일 스레드(대화)를 복원합니다. 최근 100건에서 검색합니다.",
      inputSchema: {
        type: "object" as const,
        properties: {
          subject_keyword: { type: "string", description: "제목에 포함된 키워드" },
        },
        required: ["subject_keyword"],
      },
    },

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/jhw7500/email-mcp-server'

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