read_email
Get the full content of an email, including body, headers, and attachments, by providing the email ID.
Instructions
Read the full content of a specific email including body, headers, and attachments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| email_id | Yes | The email ID to read |
Implementation Reference
- mcp-server/src/index.ts:116-120 (handler)The handler function for the read_email tool. Takes an email_id parameter, fetches the email from the Blip API at /v1/emails/{email_id}, and returns the full email content including body, headers, and attachments.
async ({ email_id }) => { const result = await blipFetch(`/v1/emails/${email_id}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } ); - mcp-server/src/index.ts:113-115 (schema)Input schema for the read_email tool, defined with Zod. Requires a single string parameter 'email_id'.
{ email_id: z.string().describe("The email ID to read"), }, - mcp-server/src/index.ts:110-120 (registration)Registration of the 'read_email' tool on the MCP server via server.tool(). The tool is named 'read_email', has a description, a Zod schema for input, and a handler callback.
server.tool( "read_email", "Read the full content of a specific email including body, headers, and attachments.", { email_id: z.string().describe("The email ID to read"), }, async ({ email_id }) => { const result = await blipFetch(`/v1/emails/${email_id}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } ); - mcp-server/src/index.ts:24-45 (helper)Helper function blipFetch that makes authenticated HTTP requests to the Blip API. Used by the read_email handler to fetch the email data.
async function blipFetch( path: string, options: RequestInit = {} ): Promise<unknown> { const url = `${API_URL}${path}`; const res = await fetch(url, { ...options, headers: { Authorization: `Bearer ${API_KEY}`, "Content-Type": "application/json", ...options.headers, }, }); if (!res.ok) { const body = await res.text(); throw new Error(`Blip API error ${res.status} on ${options.method || "GET"} ${path}: ${body}`); } if (res.status === 204) return null; return res.json(); }