Skip to main content
Glama

airbnb_listing_details

Retrieve comprehensive property details for specific Airbnb listings, including amenities, policies, pricing, and direct booking links.

Instructions

Get detailed information about a specific Airbnb listing. Provide direct links to the user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe Airbnb listing ID
checkinNoCheck-in date (YYYY-MM-DD)
checkoutNoCheck-out date (YYYY-MM-DD)
adultsNoNumber of adults
childrenNoNumber of children
infantsNoNumber of infants
petsNoNumber of pets
ignoreRobotsTextNoIgnore robots.txt rules for this request

Implementation Reference

  • The primary handler function that implements the core logic of the 'airbnb_listing_details' tool. It constructs the Airbnb listing URL with optional check-in/out dates and guest counts, respects robots.txt rules, fetches the page HTML, parses the embedded JSON data, filters specific sections (location, policies, highlights, description, amenities), and returns a JSON object with the listing details.
    async function handleAirbnbListingDetails(params: any) {
      const {
        id,
        checkin,
        checkout,
        adults = 1,
        children = 0,
        infants = 0,
        pets = 0,
        ignoreRobotsText = false,
      } = params;
    
      const listingUrl = new URL(`${BASE_URL}/rooms/${id}`);
      
      if (checkin) listingUrl.searchParams.append("check_in", checkin);
      if (checkout) listingUrl.searchParams.append("check_out", checkout);
      
      const adults_int = parseInt(adults.toString());
      const children_int = parseInt(children.toString());
      const infants_int = parseInt(infants.toString());
      const pets_int = parseInt(pets.toString());
      
      const totalGuests = adults_int + children_int;
      if (totalGuests > 0) {
        listingUrl.searchParams.append("adults", adults_int.toString());
        listingUrl.searchParams.append("children", children_int.toString());
        listingUrl.searchParams.append("infants", infants_int.toString());
        listingUrl.searchParams.append("pets", pets_int.toString());
      }
    
      const path = listingUrl.pathname + listingUrl.search;
      if (!ignoreRobotsText && !isPathAllowed(path)) {
        log('warn', 'Listing details blocked by robots.txt', { path, url: listingUrl.toString() });
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              error: robotsErrorMessage,
              url: listingUrl.toString(),
              suggestion: "Consider enabling 'ignore_robots_txt' in extension settings if needed for testing"
            }, null, 2)
          }],
          isError: true
        };
      }
    
      const allowSectionSchema = {
        "LOCATION_DEFAULT": {
          lat: true,
          lng: true,
          subtitle: true,
          title: true
        },
        "POLICIES_DEFAULT": {
          title: true,
          houseRulesSections: {
            title: true,
            items : {
              title: true
            }
          }
        },
        "HIGHLIGHTS_DEFAULT": {
          highlights: {
            title: true
          }
        },
        "DESCRIPTION_DEFAULT": {
          htmlDescription: {
            htmlText: true
          }
        },
        "AMENITIES_DEFAULT": {
          title: true,
          seeAllAmenitiesGroups: {
            title: true,
            amenities: {
              title: true
            }
          }
        },
      };
    
      try {
        log('info', 'Fetching listing details', { id, checkin, checkout, adults, children });
        
        const response = await fetchWithUserAgent(listingUrl.toString());
        const html = await response.text();
        const $ = cheerio.load(html);
        
        let details = {};
        
        try {
          const scriptElement = $("#data-deferred-state-0").first();
          if (scriptElement.length === 0) {
            throw new Error("Could not find data script element - page structure may have changed");
          }
          
          const scriptContent = $(scriptElement).text();
          if (!scriptContent) {
            throw new Error("Data script element is empty");
          }
          
          const clientData = JSON.parse(scriptContent).niobeClientData[0][1];
          const sections = clientData.data.presentation.stayProductDetailPage.sections.sections;
          sections.forEach((section: any) => cleanObject(section));
    
          details = sections
            .filter((section: any) => allowSectionSchema.hasOwnProperty(section.sectionId))
            .map((section: any) => {
              return {
                id: section.sectionId,
                ...flattenArraysInObject(pickBySchema(section.section, allowSectionSchema[section.sectionId as keyof typeof allowSectionSchema]))
              }
            });
            
          log('info', 'Listing details fetched successfully', { 
            id, 
            sectionsFound: Array.isArray(details) ? details.length : 0 
          });
        } catch (parseError) {
          log('error', 'Failed to parse listing details', {
            error: parseError instanceof Error ? parseError.message : String(parseError),
            id,
            url: listingUrl.toString()
          });
          
          return {
            content: [{
              type: "text",
              text: JSON.stringify({
                error: "Failed to parse listing details from Airbnb. The page structure may have changed.",
                details: parseError instanceof Error ? parseError.message : String(parseError),
                listingUrl: listingUrl.toString()
              }, null, 2)
            }],
            isError: true
          };
        }
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              listingUrl: listingUrl.toString(),
              details: details
            }, null, 2)
          }],
          isError: false
        };
      } catch (error) {
        log('error', 'Listing details request failed', {
          error: error instanceof Error ? error.message : String(error),
          id,
          url: listingUrl.toString()
        });
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              error: error instanceof Error ? error.message : String(error),
              listingUrl: listingUrl.toString(),
              timestamp: new Date().toISOString()
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Tool definition object containing the name, description, and input schema (JSON Schema) for validating parameters like required 'id' and optional dates/guests.
    const AIRBNB_LISTING_DETAILS_TOOL = {
      name: "airbnb_listing_details",
      description: "Get detailed information about a specific Airbnb listing. Provide direct links to the user",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "The Airbnb listing ID"
          },
          checkin: {
            type: "string",
            description: "Check-in date (YYYY-MM-DD)"
          },
          checkout: {
            type: "string",
            description: "Check-out date (YYYY-MM-DD)"
          },
          adults: {
            type: "number",
            description: "Number of adults"
          },
          children: {
            type: "number",
            description: "Number of children"
          },
          infants: {
            type: "number",
            description: "Number of infants"
          },
          pets: {
            type: "number",
            description: "Number of pets"
          },
          ignoreRobotsText: {
            type: "boolean",
            description: "Ignore robots.txt rules for this request"
          }
        },
        required: ["id"]
      }
    };
  • index.ts:137-141 (registration)
    Registers the tool by including it in the AIRBNB_TOOLS array, which is exposed via the ListTools MCP request handler.
    const AIRBNB_TOOLS = [
      AIRBNB_SEARCH_TOOL,
      AIRBNB_LISTING_DETAILS_TOOL,
      ...photoAnalysisTools,
    ];
  • index.ts:629-631 (registration)
    MCP server request handler for listing available tools, which returns the AIRBNB_TOOLS array including 'airbnb_listing_details'.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: AIRBNB_TOOLS,
    }));
  • index.ts:661-664 (registration)
    Dispatch logic in the CallTool MCP request handler that routes calls to 'airbnb_listing_details' to the specific handler function.
    case "airbnb_listing_details": {
      result = await handleAirbnbListingDetails(request.params.arguments);
      break;
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility for disclosing behavior. It mentions that direct links are provided, but does not disclose side effects, whether the operation is read-only, permission requirements, error behavior, or any other behavioral traits. This is a significant gap for a tool expected to be called autonomously.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise at two sentences and the primary purpose is front-loaded. The second sentence about providing direct links is an added behavior, which is useful but could be integrated more seamlessly. No wasted words, though the structure could be tightened.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 8 parameters, no output schema, and no annotations, the description is not complete. It does not explain what 'detailed information' includes, how the optional parameters influence results, or what the expected response format looks like. An agent would have to guess many details about invocation and results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All 8 parameters have descriptions in the schema (100% coverage), so the baseline of 3 applies. The tool description itself adds no additional meaning beyond what the schema already provides; it does not explain how parameters like pets, adults, or checkin/checkout dates affect the returned details or links.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves detailed information for a specific Airbnb listing and identifies that direct links are provided. It distinguishes implicitly from the sibling airbnb_search by focusing on a specific listing rather than searching, though it does not explicitly name the sibling.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus airbnb_search. There is no mention of prerequisites (such as having a listing ID) or scenarios that would favor this tool over the search sibling. The description leaves usage entirely to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.