extract_codes
Extract OTP codes and verification links from the most recent email in an inbox. Use after creating an inbox and receiving a verification or signup email to retrieve codes automatically.
Instructions
Extract OTP codes and verification links from the most recent email in an inbox. Use this after creating an inbox and receiving a verification/signup email.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inbox_id | Yes | The inbox ID to extract codes from (uses most recent email) |
Implementation Reference
- mcp-server/src/index.ts:122-134 (registration)Registration of the 'extract_codes' tool on the MCP server using server.tool().
server.tool( "extract_codes", "Extract OTP codes and verification links from the most recent email in an inbox. Use this after creating an inbox and receiving a verification/signup email.", { inbox_id: z .string() .describe("The inbox ID to extract codes from (uses most recent email)"), }, async ({ inbox_id }) => { const result = await blipFetch(`/v1/inboxes/${inbox_id}/extract`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } ); - mcp-server/src/index.ts:125-129 (schema)Schema definition for the 'extract_codes' tool - requires one parameter: inbox_id (string).
{ inbox_id: z .string() .describe("The inbox ID to extract codes from (uses most recent email)"), }, - mcp-server/src/index.ts:130-133 (handler)Handler function for 'extract_codes' - calls /v1/inboxes/{inbox_id}/extract via blipFetch and returns the result as JSON text.
async ({ inbox_id }) => { const result = await blipFetch(`/v1/inboxes/${inbox_id}/extract`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } - mcp-server/src/index.ts:24-45 (helper)Helper function 'blipFetch' used by the extract_codes handler to make authenticated HTTP requests to the Blip API.
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(); }