Skip to main content

@flow-state-dev/tools/crawl

Interfaces​

CrawlProviderAdapter​

Properties​

name​
name: "firecrawl" | "builtin";

Methods​

crawl()​
crawl(url, options): Promise<{
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}>;
Parameters​
url​

string

options​
allowedHosts?​

string[]

See CrawlConfig.allowedHosts.

apiKey?​

string

excludePatterns​

string[]

includePatterns​

string[]

maxDepth​

number

maxPages​

number

signal?​

AbortSignal

The run's signal; aborting it ends the crawl.

waitForJS​

boolean

Returns​

Promise<{ crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }>

Functions​

builtinCrawl()​

function builtinCrawl(config?): BlockDefinition<ZodObject<{
maxDepth: ZodOptional<ZodNumber>;
maxPages: ZodOptional<ZodNumber>;
url: ZodString;
}, "strip", ZodTypeAny, {
maxDepth?: number;
maxPages?: number;
url: string;
}, {
maxDepth?: number;
maxPages?: number;
url: string;
}>, ZodObject<{
crawlDepth: ZodNumber;
pages: ZodArray<ZodObject<{
markdown: ZodString;
metadata: ZodObject<{
contentType: ZodString;
description: ZodOptional<ZodString>;
publishedDate: ZodOptional<ZodString>;
statusCode: ZodNumber;
wordCount: ZodNumber;
}, "strip", ZodTypeAny, {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
}, {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
}>;
source: ZodEnum<["firecrawl", "jina", "builtin"]>;
title: ZodString;
url: ZodString;
}, "strip", ZodTypeAny, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>, "many">;
rootUrl: ZodString;
source: ZodEnum<["firecrawl", "builtin"]>;
totalPages: ZodNumber;
}, "strip", ZodTypeAny, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}>, {
maxDepth?: number;
maxPages?: number;
url: string;
}, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}>;

Parameters​

config?​

Omit<CrawlConfig, "provider">

Returns​

BlockDefinition<ZodObject<{ maxDepth: ZodOptional<ZodNumber>; maxPages: ZodOptional<ZodNumber>; url: ZodString; }, "strip", ZodTypeAny, { maxDepth?: number; maxPages?: number; url: string; }, { maxDepth?: number; maxPages?: number; url: string; }>, ZodObject<{ crawlDepth: ZodNumber; pages: ZodArray<ZodObject<{ markdown: ZodString; metadata: ZodObject<{ contentType: ZodString; description: ZodOptional<ZodString>; publishedDate: ZodOptional<ZodString>; statusCode: ZodNumber; wordCount: ZodNumber; }, "strip", ZodTypeAny, { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }, { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }>; source: ZodEnum<["firecrawl", "jina", "builtin"]>; title: ZodString; url: ZodString; }, "strip", ZodTypeAny, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>, "many">; rootUrl: ZodString; source: ZodEnum<["firecrawl", "builtin"]>; totalPages: ZodNumber; }, "strip", ZodTypeAny, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }>, { maxDepth?: number; maxPages?: number; url: string; }, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }>


crawl()​

function crawl(config?): BlockDefinition<ZodObject<{
maxDepth: ZodOptional<ZodNumber>;
maxPages: ZodOptional<ZodNumber>;
url: ZodString;
}, "strip", ZodTypeAny, {
maxDepth?: number;
maxPages?: number;
url: string;
}, {
maxDepth?: number;
maxPages?: number;
url: string;
}>, ZodObject<{
crawlDepth: ZodNumber;
pages: ZodArray<ZodObject<{
markdown: ZodString;
metadata: ZodObject<{
contentType: ZodString;
description: ZodOptional<ZodString>;
publishedDate: ZodOptional<ZodString>;
statusCode: ZodNumber;
wordCount: ZodNumber;
}, "strip", ZodTypeAny, {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
}, {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
}>;
source: ZodEnum<["firecrawl", "jina", "builtin"]>;
title: ZodString;
url: ZodString;
}, "strip", ZodTypeAny, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>, "many">;
rootUrl: ZodString;
source: ZodEnum<["firecrawl", "builtin"]>;
totalPages: ZodNumber;
}, "strip", ZodTypeAny, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}>, {
maxDepth?: number;
maxPages?: number;
url: string;
}, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}>;

Creates a crawl tool for use in generator blocks. Auto-detects the best available crawl provider from env vars. Always works — falls back to built-in BFS crawler.

Provider priority: Firecrawl → Built-in BFS

Parameters​

config?​

CrawlConfig

Returns​

BlockDefinition<ZodObject<{ maxDepth: ZodOptional<ZodNumber>; maxPages: ZodOptional<ZodNumber>; url: ZodString; }, "strip", ZodTypeAny, { maxDepth?: number; maxPages?: number; url: string; }, { maxDepth?: number; maxPages?: number; url: string; }>, ZodObject<{ crawlDepth: ZodNumber; pages: ZodArray<ZodObject<{ markdown: ZodString; metadata: ZodObject<{ contentType: ZodString; description: ZodOptional<ZodString>; publishedDate: ZodOptional<ZodString>; statusCode: ZodNumber; wordCount: ZodNumber; }, "strip", ZodTypeAny, { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }, { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }>; source: ZodEnum<["firecrawl", "jina", "builtin"]>; title: ZodString; url: ZodString; }, "strip", ZodTypeAny, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>, "many">; rootUrl: ZodString; source: ZodEnum<["firecrawl", "builtin"]>; totalPages: ZodNumber; }, "strip", ZodTypeAny, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }>, { maxDepth?: number; maxPages?: number; url: string; }, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }>


firecrawlCrawl()​

function firecrawlCrawl(config?): BlockDefinition<ZodObject<{
maxDepth: ZodOptional<ZodNumber>;
maxPages: ZodOptional<ZodNumber>;
url: ZodString;
}, "strip", ZodTypeAny, {
maxDepth?: number;
maxPages?: number;
url: string;
}, {
maxDepth?: number;
maxPages?: number;
url: string;
}>, ZodObject<{
crawlDepth: ZodNumber;
pages: ZodArray<ZodObject<{
markdown: ZodString;
metadata: ZodObject<{
contentType: ZodString;
description: ZodOptional<ZodString>;
publishedDate: ZodOptional<ZodString>;
statusCode: ZodNumber;
wordCount: ZodNumber;
}, "strip", ZodTypeAny, {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
}, {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
}>;
source: ZodEnum<["firecrawl", "jina", "builtin"]>;
title: ZodString;
url: ZodString;
}, "strip", ZodTypeAny, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>, "many">;
rootUrl: ZodString;
source: ZodEnum<["firecrawl", "builtin"]>;
totalPages: ZodNumber;
}, "strip", ZodTypeAny, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}>, {
maxDepth?: number;
maxPages?: number;
url: string;
}, {
crawlDepth: number;
pages: object[];
rootUrl: string;
source: "firecrawl" | "builtin";
totalPages: number;
}>;

Parameters​

config?​

Omit<CrawlConfig, "provider">

Returns​

BlockDefinition<ZodObject<{ maxDepth: ZodOptional<ZodNumber>; maxPages: ZodOptional<ZodNumber>; url: ZodString; }, "strip", ZodTypeAny, { maxDepth?: number; maxPages?: number; url: string; }, { maxDepth?: number; maxPages?: number; url: string; }>, ZodObject<{ crawlDepth: ZodNumber; pages: ZodArray<ZodObject<{ markdown: ZodString; metadata: ZodObject<{ contentType: ZodString; description: ZodOptional<ZodString>; publishedDate: ZodOptional<ZodString>; statusCode: ZodNumber; wordCount: ZodNumber; }, "strip", ZodTypeAny, { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }, { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }>; source: ZodEnum<["firecrawl", "jina", "builtin"]>; title: ZodString; url: ZodString; }, "strip", ZodTypeAny, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>, "many">; rootUrl: ZodString; source: ZodEnum<["firecrawl", "builtin"]>; totalPages: ZodNumber; }, "strip", ZodTypeAny, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }>, { maxDepth?: number; maxPages?: number; url: string; }, { crawlDepth: number; pages: object[]; rootUrl: string; source: "firecrawl" | "builtin"; totalPages: number; }>

References​

CrawlConfig​

Re-exports CrawlConfig


CrawlInput​

Re-exports CrawlInput


crawlInputSchema​

Re-exports crawlInputSchema


CrawlProviderName​

Re-exports CrawlProviderName


crawlProviders​

Re-exports crawlProviders


CrawlResult​

Re-exports CrawlResult


crawlResultSchema​

Re-exports crawlResultSchema