one_map
Discover and extract URLs from a starting point using sitemap.xml or HTML link discovery. Filter results by search terms, subdomains, and limits to streamline web data collection.
Instructions
Discover URLs from a starting point. Can use both sitemap.xml and HTML link discovery.
Input Schema
TableJSON 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:343-366 (handler)The main handler function that executes the 'one_map' tool logic by calling firecrawl.mapUrl, processing the response, and returning formatted content.async function processMapUrl(url: string, args: MapParams) { const res = await firecrawl.mapUrl(url, { ...args, }); if ('error' in res) { throw new Error(`Failed to map: ${res.error}`); } if (!res.links) { throw new Error(`No links found from: ${url}`); } return { content: [ { type: 'text', text: res.links.join('\n').trim(), }, ], result: res.links, success: true, }; }
- src/tools.ts:61-95 (schema)Defines the tool metadata, name, description, and input schema for 'one_map'.export const MAP_TOOL: Tool = { name: 'one_map', description: 'Discover URLs from a starting point. Can use both sitemap.xml and HTML link discovery.', 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:179-206 (registration)Switch case in the main tool dispatcher that handles 'one_map' tool calls by validating args and invoking the processMapUrl handler.case 'one_map': { if (!checkMapArgs(args)) { throw new Error(`Invalid arguments for tool: [${name}]`); } try { const { content, success, result } = await processMapUrl(args.url, args); return { content, result, success, }; } catch (error) { server.sendLoggingMessage({ level: 'error', data: `[${new Date().toISOString()}] Error mapping: ${error}`, }); const msg = error instanceof Error ? error.message : String(error); return { success: false, content: [ { type: 'text', text: msg, }, ], }; } }
- src/index.ts:386-393 (helper)Helper function to validate input arguments for the 'one_map' tool.function checkMapArgs(args: unknown): args is MapParams & { url: string } { return ( typeof args === 'object' && args !== null && 'url' in args && typeof args.url === 'string' ); }