nworks_mail_read
Retrieve detailed email content including body text and attachments from LINE WORKS mailboxes using mail ID. Requires OAuth authentication with mail.read scope.
Instructions
특정 메일의 상세 내용(본문, 첨부파일 등)을 조회합니다. '이 메일 내용 보여줘' 등의 요청에 사용. mailId는 nworks_mail_list로 조회 가능. User OAuth 인증 필요 (mail.read scope)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mailId | Yes | 메일 ID (nworks_mail_list로 조회 가능) | |
| userId | No | 대상 사용자 ID (미지정 시 me) |
Implementation Reference
- src/api/mail.ts:162-178 (handler)The actual implementation of the mail reading logic.
export async function readMail( mailId: number, userId = "me", profile = "default" ): Promise<MailDetail> { const url = `${BASE_URL}/users/${sanitizePathSegment(userId)}/mail/${sanitizePathSegment(String(mailId))}`; if (process.env["NWORKS_VERBOSE"] === "1") { console.error(`[nworks] GET ${url}`); } const res = await authedFetch(url, { method: "GET" }, profile); if (!res.ok) return handleError(res); return (await res.json()) as MailDetail; } - src/mcp/tools.ts:597-610 (registration)The tool registration and invocation of the handler for 'nworks_mail_read'.
server.tool( "nworks_mail_read", "특정 메일의 상세 내용(본문, 첨부파일 등)을 조회합니다. '이 메일 내용 보여줘' 등의 요청에 사용. mailId는 nworks_mail_list로 조회 가능. User OAuth 인증 필요 (mail.read scope)", { mailId: z.number().describe("메일 ID (nworks_mail_list로 조회 가능)"), userId: z.string().optional().describe("대상 사용자 ID (미지정 시 me)"), }, async ({ mailId, userId }) => { try { const result = await mailApi.readMail( mailId, userId ?? "me" ); const mail = result.mail; - src/api/mail.ts:45-67 (schema)Type definition for MailDetail (the output of the mail reading operation).
export interface MailDetail { mail: { mailId: number; folderId: number; status: number; from: MailAddress; to: MailAddress[]; cc?: MailAddress[]; bcc?: MailAddress[]; subject: string; body: string; receivedTime: string; sentTime?: string; size: number; securityLevel?: string; }; attachments?: Array<{ attachmentId: number; contentType: string; filename: string; size: number; }>; }