firecrawl_map
Discover all indexed URLs on a website to identify pages for scraping or locate specific sections before content extraction.
Instructions
Map a website to discover all indexed URLs on the site.
Best for: Discovering URLs on a website before deciding what to scrape; finding specific sections of a website. Not recommended for: When you already know which specific URL you need (use scrape or batch_scrape); when you need the content of the pages (use scrape after mapping). Common mistakes: Using crawl to discover URLs instead of map. Prompt Example: "List all URLs on example.com." Usage Example:
Returns: Array of URLs found on the site.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ignoreSitemap | No | Skip sitemap.xml discovery and only use HTML links | |
| includeSubdomains | No | Include URLs from subdomains in results | |
| limit | No | Maximum number of URLs to return | |
| search | No | Optional search term to filter URLs | |
| sitemapOnly | No | Only use sitemap.xml for discovery, ignore HTML links | |
| url | Yes | Starting URL for URL discovery |
Implementation Reference
- src/index.ts:1083-1105 (handler)The main handler function for the 'firecrawl_map' tool. It validates the input arguments using isMapOptions, destructures the URL and options, calls the FirecrawlApp client's mapUrl method, handles errors, and returns the mapped URLs as a text content block.case 'firecrawl_map': { if (!isMapOptions(args)) { throw new Error('Invalid arguments for firecrawl_map'); } const { url, ...options } = args; const response = await client.mapUrl(url, { ...options, // @ts-expect-error Extended API options including origin origin: 'mcp-server', }); if ('error' in response) { throw new Error(response.error); } if (!response.links) { throw new Error('No links received from Firecrawl API'); } return { content: [ { type: 'text', text: trimResponseText(response.links.join('\n')) }, ], isError: false, }; }
- src/index.ts:203-253 (schema)Tool definition for 'firecrawl_map' including name, description, and detailed inputSchema for validation of parameters like url, search, limits, etc.const MAP_TOOL: Tool = { name: 'firecrawl_map', description: ` Map a website to discover all indexed URLs on the site. **Best for:** Discovering URLs on a website before deciding what to scrape; finding specific sections of a website. **Not recommended for:** When you already know which specific URL you need (use scrape or batch_scrape); when you need the content of the pages (use scrape after mapping). **Common mistakes:** Using crawl to discover URLs instead of map. **Prompt Example:** "List all URLs on example.com." **Usage Example:** \`\`\`json { "name": "firecrawl_map", "arguments": { "url": "https://example.com" } } \`\`\` **Returns:** Array of URLs found on the site. `, inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'Starting URL for URL discovery', }, search: { type: 'string', description: 'Optional search term to filter URLs', }, ignoreSitemap: { type: 'boolean', description: 'Skip sitemap.xml discovery and only use HTML links', }, sitemapOnly: { type: 'boolean', description: 'Only use sitemap.xml for discovery, ignore HTML links', }, includeSubdomains: { type: 'boolean', description: 'Include URLs from subdomains in results', }, limit: { type: 'number', description: 'Maximum number of URLs to return', }, }, required: ['url'], }, };
- src/index.ts:962-973 (registration)Registration of the firecrawl_map tool (as MAP_TOOL) in the listTools request handler, making it discoverable by MCP clients.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ SCRAPE_TOOL, MAP_TOOL, CRAWL_TOOL, CHECK_CRAWL_STATUS_TOOL, SEARCH_TOOL, EXTRACT_TOOL, DEEP_RESEARCH_TOOL, GENERATE_LLMSTXT_TOOL, ], }));
- src/index.ts:794-801 (helper)Type guard helper function isMapOptions used to validate input arguments for the firecrawl_map handler.function isMapOptions(args: unknown): args is MapParams & { url: string } { return ( typeof args === 'object' && args !== null && 'url' in args && typeof (args as { url: unknown }).url === 'string' ); }