Home/Tools/firecrawl-aisdk

scrapeTool

firecrawl-aisdk

Scrape content from a single URL with advanced options. Best for: Single page content extraction when you know the exact URL. Returns: Content in specified formats (markdown, html, rawHtml, screenshot, or links). Example use cases: - Extract article content from a blog post - Get product information from an e-commerce page - Scrape documentation from a specific page

by firecrawl

search
v0.7.2
MIT

Interactive Playground

Test firecrawl-aisdk (scrapeTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install firecrawl-aisdk
pnpm add firecrawl-aisdk

2. Import the tool

import { scrapeTool } from 'firecrawl-aisdk';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool } from 'firecrawl-aisdk';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { scrapeTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

AI Agent Integration

How AI agents can use this tool

Use Case

Use when you need to convert web pages to clean, structured markdown

Examples

  • Scrape documentation pages
  • Extract article content
  • Convert web pages to markdown

Parameters

Available configuration options

Auto-extracted
url
Required
Type: string

The URL to scrape content from

formats
Optional
Type: array

Output formats for the scraped content

parsers
Optional
Type: array

Parsers to use for processing content (e.g., PDF parsing)

onlyMainContent
Optional
Type: boolean

Extract only the main content, removing headers, footers, and navigation

includeTags
Optional
Type: array

HTML tags to include in the output

excludeTags
Optional
Type: array

HTML tags to exclude from the output

waitFor
Optional
Type: number

Time in milliseconds to wait before scraping

actions
Optional
Type: array

Browser actions to perform before scraping (click, scroll, type, wait, etc.)

mobile
Optional
Type: boolean

Emulate mobile device

skipTlsVerification
Optional
Type: boolean

Skip TLS certificate verification

removeBase64Images
Optional
Type: boolean

Remove base64 encoded images from the output

location
Optional
Type: object

Location settings for the scraping request

storeInCache
Optional
Type: boolean

Store the scraped content in cache

maxAge
Optional
Type: number

Maximum age of cached content in milliseconds. Default: 172800000 (2 days)

headers
Optional
Type: object

Custom headers to send with the request (cookies, user-agent, etc.)

blockAds
Optional
Type: boolean

Enable ad-blocking and cookie popup blocking. Default: true

proxy
Optional
Type: string

Proxy type: basic (fast), stealth (reliable, 5 credits), auto (retry with stealth). Default: auto

zeroDataRetention
Optional
Type: boolean

Enable zero data retention. Contact help@firecrawl.dev to enable this feature

timeout
Optional
Type: number

Timeout in milliseconds. Default: 60000

Schema extracted: 12/29/2025, 3:52:29 AM

README

Firecrawl AI SDK Tools

Firecrawl tools for Vercel AI SDK v5. Web scraping, search, crawling, and data extraction for AI applications.

Install

npm install firecrawl-aisdk ai @ai-sdk/openai

Set environment variables:

FIRECRAWL_API_KEY=fc-your-key
OPENAI_API_KEY=sk-your-key

Quick Start

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and summarize what it does',
  tools: { scrape: scrapeTool },
});

Available Tools

import {
  scrapeTool,         // Scrape single URL
  searchTool,         // Search the web
  mapTool,            // Discover URLs on a site
  crawlTool,          // Crawl multiple pages
  batchScrapeTool,    // Scrape multiple URLs
  extractTool,        // Extract structured data
  pollTool,           // Poll async jobs
  statusTool,         // Check job status
  cancelTool,         // Cancel jobs
} from 'firecrawl-aisdk';

Examples

Scrape

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and summarize what it does',
  tools: { scrape: scrapeTool },
});

console.log(text);

Search

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { searchTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Search for Firecrawl and summarize what you find',
  tools: { search: searchTool },
});

console.log(text);

Map

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { mapTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Map https://docs.firecrawl.dev and list the main sections',
  tools: { map: mapTool },
});

console.log(text);

Crawl (async - requires polling)

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { crawlTool, pollTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Crawl https://docs.firecrawl.dev (limit 3 pages) and summarize',
  tools: { crawl: crawlTool, poll: pollTool },
});

console.log(text);

Batch (async - requires polling)

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { batchScrapeTool, pollTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and https://docs.firecrawl.dev, then compare',
  tools: { batchScrape: batchScrapeTool, poll: pollTool },
});

console.log(text);

Extract (async - requires polling)

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { extractTool, pollTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Extract the main features from https://firecrawl.dev',
  tools: { extract: extractTool, poll: pollTool },
});

console.log(text);

Search + Scrape

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { searchTool, scrapeTool } from 'firecrawl-aisdk';

const { text } = await generateText({
  model: openai('gpt-5-mini'),
  prompt: 'Search for Firecrawl, scrape the top result, and explain what it does',
  tools: { search: searchTool, scrape: scrapeTool },
});

console.log(text);

Stream

import { streamText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { scrapeTool } from 'firecrawl-aisdk';

const result = streamText({
  model: openai('gpt-5-mini'),
  prompt: 'Scrape https://firecrawl.dev and explain what it does',
  tools: { scrape: scrapeTool },
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Development

Run tests:

pnpm test          # Run all tests
pnpm test:watch    # Watch mode

License

MIT

Statistics

Downloads/month

2,435

GitHub Stars

0

Quality Score

90%

NPM Keywords

ai
ai-sdk
vercel
firecrawl
web-scraping
web-search
tools
llm

Maintainers

hello_sideguide(hello@sideguide.dev)

Frameworks

vercel-ai