Skip to main content
Glama

get_quote

Obtain insurance quotes for renters, homeowners, pet, or car coverage by providing your ZIP code and desired insurance type.

Instructions

Get an insurance quote from Lemonade for renters, homeowners, pet, or car insurance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
insurance_typeYesType of insurance to get a quote for
zip_codeYesZIP code for the insurance location
coverage_amountNoDesired coverage amount in dollars (optional)
additional_infoNoAdditional information specific to the insurance type

Implementation Reference

  • The handleGetQuote function performs the logic for the get_quote tool, navigating to the relevant Lemonade insurance page and extracting information.
    async function handleGetQuote(args: {
      insurance_type: string;
      zip_code: string;
      coverage_amount?: number;
      additional_info?: Record<string, unknown>;
    }): Promise<string> {
      const urlMap: Record<string, string> = {
        renters: `${LEMONADE_BASE_URL}/renters-insurance`,
        homeowners: `${LEMONADE_BASE_URL}/homeowners-insurance`,
        pet: `${LEMONADE_BASE_URL}/pet-health-insurance`,
        car: `${LEMONADE_BASE_URL}/car-insurance`,
      };
    
      const url = urlMap[args.insurance_type] || LEMONADE_BASE_URL;
    
      return withBrowser(async (browser, page) => {
        await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 });
        await page.waitForTimeout(2000);
    
        const title = await page.title();
        const description = await page
          .$eval('meta[name="description"]', (el) =>
            el.getAttribute("content")
          )
          .catch(() => "No description available");
    
        // Extract key information from the page
        const pageText = await page
          .evaluate(() => {
            const body = document.body;
            const scripts = body.querySelectorAll("script, style");
            scripts.forEach((s) => s.remove());
            return body.innerText.substring(0, 2000);
          })
          .catch(() => "Unable to extract page content");
    
        return JSON.stringify({
          status: "success",
          insurance_type: args.insurance_type,
          zip_code: args.zip_code,
          quote_url: url,
          page_title: title,
          description,
          instructions: `To get a quote for ${args.insurance_type} insurance in ZIP ${args.zip_code}, visit ${url} and complete the online quote form. Coverage amount requested: ${args.coverage_amount ? `$${args.coverage_amount}` : "Not specified"}.`,
          page_content_preview: pageText.substring(0, 500),
        });
      });
    }
  • src/index.ts:13-39 (registration)
    The tool definition and metadata for get_quote.
    const tools: Tool[] = [
      {
        name: "get_quote",
        description:
          "Get an insurance quote from Lemonade for renters, homeowners, pet, or car insurance",
        inputSchema: {
          type: "object",
          properties: {
            insurance_type: {
              type: "string",
              enum: ["renters", "homeowners", "pet", "car"],
              description: "Type of insurance to get a quote for",
            },
            zip_code: {
              type: "string",
              description: "ZIP code for the insurance location",
            },
            coverage_amount: {
              type: "number",
              description: "Desired coverage amount in dollars (optional)",
            },
            additional_info: {
              type: "object",
              description: "Additional information specific to the insurance type",
            },
          },
          required: ["insurance_type", "zip_code"],
  • Input schema for the get_quote tool.
    inputSchema: {
      type: "object",
      properties: {
        insurance_type: {
          type: "string",
          enum: ["renters", "homeowners", "pet", "car"],
          description: "Type of insurance to get a quote for",
        },
        zip_code: {
          type: "string",
          description: "ZIP code for the insurance location",
        },
        coverage_amount: {
          type: "number",
          description: "Desired coverage amount in dollars (optional)",
        },
        additional_info: {
          type: "object",
          description: "Additional information specific to the insurance type",
        },
      },
      required: ["insurance_type", "zip_code"],

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/markswendsen-code/mcp-lemonade'

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