Skip to main content
Glama

getListingPhotos

Extract photo URLs from Airbnb listings to access property images for verification, marketing, or research purposes.

Instructions

Extract photo URLs from an Airbnb listing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesAirbnb listing ID

Implementation Reference

  • Defines the tool schema including input validation for the listing ID parameter.
    {
      name: 'getListingPhotos',
      description: 'Extract photo URLs from an Airbnb listing',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'string', description: 'Airbnb listing ID' },
        },
        required: ['id'],
      },
    },
  • index.ts:138-141 (registration)
    Registers the getListingPhotos tool by including photoAnalysisTools in the main AIRBNB_TOOLS array used for listing tools.
      AIRBNB_SEARCH_TOOL,
      AIRBNB_LISTING_DETAILS_TOOL,
      ...photoAnalysisTools,
    ];
  • index.ts:666-670 (registration)
    Registers the dispatching logic for getListingPhotos tool calls in the main CallToolRequestHandler switch statement.
    case "getListingPhotos":
    case "analyzeListingPhotos": {
      result = await handlePhotoAnalysisTool(request.params.name, request.params.arguments);
      break;
    }
  • Main handler function for getListingPhotos tool: validates input, extracts photos, formats and returns MCP response.
    export async function handlePhotoAnalysisTool(toolName: string, toolInput: any) {
      try {
        const listingId = toolInput.id;
        if (!listingId) {
          return {
            content: [{ type: 'text', text: JSON.stringify({ error: 'Listing ID required' }) }],
            isError: true,
          };
        }
    
        const photos = await extractListingPhotos(listingId);
    
        if (toolName === 'getListingPhotos') {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: photos.extractionSuccess,
                  photoCount: photos.photoCount,
                  photoUrls: photos.photoUrls,
                }),
              },
            ],
            isError: !photos.extractionSuccess,
          };
        }
    
        if (toolName === 'analyzeListingPhotos') {
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify({
                  success: photos.extractionSuccess,
                  photoCount: photos.photoCount,
                  analysisPrompt: formatPhotosForAnalysis(photos),
                  photoUrls: photos.photoUrls,
                }),
              },
            ],
            isError: !photos.extractionSuccess,
          };
        }
    
        return {
          content: [{ type: 'text', text: JSON.stringify({ error: 'Unknown tool' }) }],
          isError: true,
        };
      } catch (error) {
        return {
          content: [{ type: 'text', text: JSON.stringify({ error: (error instanceof Error ? error.message : 'Unknown error') }) }],
          isError: true,
        };
      }
    }
  • Helper function that performs the actual web scraping to extract photo URLs from the Airbnb listing page.
    export async function extractListingPhotos(listingId: string) {
      try {
        const url = `https://www.airbnb.com/rooms/${listingId}`;
        const response = await fetch(url, {
          headers: { 'User-Agent': 'Mozilla/5.0' },
        });
    
        if (!response.ok) throw new Error(`HTTP ${response.status}`);
    
        const html = await response.text();
        const $ = cheerio.load(html);
        const photoUrls: string[] = [];
    
        $('img[src*="airbnb"]').each((_: any, el: any) => {
          const src = $(el).attr('src');
          const alt = $(el).attr('alt');
          if (src && alt?.includes('photo') && photoUrls.length < 50) {
            if (!photoUrls.includes(src)) photoUrls.push(src);
          }
        });
    
        return {
          listingId,
          photoUrls,
          photoCount: photoUrls.length,
          extractionSuccess: photoUrls.length > 0,
          timestamp: new Date().toISOString(),
        };
      } catch (error) {
        return {
          listingId,
          photoUrls: [],
          photoCount: 0,
          extractionSuccess: false,
          error: (error instanceof Error ? error.message : 'Unknown error'),
          timestamp: new Date().toISOString(),
        };
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe how it behaves: no information on rate limits, authentication needs, error handling, or what happens if the listing ID is invalid. For a tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's appropriately sized for a simple tool and front-loads the core purpose immediately.

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?

For a tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the output looks like (e.g., format of extracted URLs, whether it's a list or structured data), nor does it cover behavioral aspects like error conditions. Given the lack of structured data, the description should provide more context to be fully helpful.

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?

The schema description coverage is 100%, with the single parameter 'id' clearly documented as 'Airbnb listing ID'. The description doesn't add any parameter details beyond what the schema provides, so it meets the baseline for high schema coverage but doesn't enhance understanding of parameter usage or constraints.

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 verb ('Extract') and resource ('photo URLs from an Airbnb listing'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'analyzeListingPhotos' which might involve more complex photo analysis rather than just URL extraction.

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?

The description provides no guidance on when to use this tool versus alternatives like 'airbnb_listing_details' (which might include photos) or 'analyzeListingPhotos'. It doesn't mention prerequisites, constraints, or typical use cases, leaving the agent to infer usage context.

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

Install Server

Other Tools

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/iclickfreedownloads/mcp-server-airbnb'

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