get_documents
Retrieve policy documents like declarations pages and contracts from Lemonade insurance by providing policy ID and email address.
Instructions
Retrieve policy documents from Lemonade (declarations page, policy contract, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy_id | Yes | The policy ID to get documents for | |
| document_type | No | Type of document to retrieve | |
| Yes | Email address associated with the policy |
Implementation Reference
- src/index.ts:423-460 (handler)The handler function `handleGetDocuments` that implements the logic for the `get_documents` tool.
async function handleGetDocuments(args: { policy_id: string; document_type?: string; email: string; }): Promise<string> { return withBrowser(async (browser, page) => { await page.goto(`${LEMONADE_BASE_URL}/login`, { waitUntil: "domcontentloaded", timeout: 30000, }); await page.waitForTimeout(1500); const docType = args.document_type || "all"; const docDescriptions: Record<string, string> = { declarations: "Declarations page showing your coverage summary", contract: "Full policy contract with terms and conditions", id_card: "Insurance ID card", all: "All available policy documents", }; return JSON.stringify({ status: "action_required", message: "Document access requires authentication.", policy_id: args.policy_id, document_type: docType, document_description: docDescriptions[docType] || docDescriptions.all, instructions: [ `1. Visit ${LEMONADE_BASE_URL}/login`, `2. Sign in with: ${args.email}`, "3. Navigate to 'My Policy' > 'Documents'", `4. Select policy: ${args.policy_id}`, `5. Download: ${docDescriptions[docType] || "your documents"}`, "", "Documents are also emailed to you when your policy is issued or renewed.", ], }); }); } - src/index.ts:141-164 (schema)The registration schema for the `get_documents` tool.
{ name: "get_documents", description: "Retrieve policy documents from Lemonade (declarations page, policy contract, etc.)", inputSchema: { type: "object", properties: { policy_id: { type: "string", description: "The policy ID to get documents for", }, document_type: { type: "string", enum: ["declarations", "contract", "id_card", "all"], description: "Type of document to retrieve", }, email: { type: "string", description: "Email address associated with the policy", }, }, required: ["policy_id", "email"], }, }, - src/index.ts:559-561 (registration)The tool dispatcher logic calling `handleGetDocuments` when `get_documents` is invoked.
case "get_documents": result = await handleGetDocuments(args as Parameters<typeof handleGetDocuments>[0]); break;