Skip to main content

@flow-state-dev/tools/fetch

Interfaces​

FetchProviderAdapter​

Properties​

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

Methods​

fetch()​
fetch(url, options): Promise<{
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>;
Parameters​
url​

string

options​
allowedHosts?​

string[]

See FetchConfig.allowedHosts.

apiKey?​

string

signal?​

AbortSignal

The run's signal; aborting it aborts the request.

waitForJS​

boolean

Returns​

Promise<{ markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>

Functions​

builtinFetch()​

function builtinFetch(config?): BlockDefinition<ZodObject<{
url: ZodString;
}, "strip", ZodTypeAny, {
url: string;
}, {
url: string;
}>, 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;
}>, {
url: string;
}, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>;

Parameters​

config?​

Omit<FetchConfig, "provider">

Returns​

BlockDefinition<ZodObject<{ url: ZodString; }, "strip", ZodTypeAny, { url: string; }, { url: string; }>, 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; }>, { url: string; }, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>


fetch()​

function fetch(config?): BlockDefinition<ZodObject<{
url: ZodString;
}, "strip", ZodTypeAny, {
url: string;
}, {
url: string;
}>, 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;
}>, {
url: string;
}, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>;

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

Provider priority: Firecrawl → Jina Reader → Built-in

Parameters​

config?​

FetchConfig

Returns​

BlockDefinition<ZodObject<{ url: ZodString; }, "strip", ZodTypeAny, { url: string; }, { url: string; }>, 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; }>, { url: string; }, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>


firecrawlFetch()​

function firecrawlFetch(config?): BlockDefinition<ZodObject<{
url: ZodString;
}, "strip", ZodTypeAny, {
url: string;
}, {
url: string;
}>, 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;
}>, {
url: string;
}, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>;

Parameters​

config?​

Omit<FetchConfig, "provider">

Returns​

BlockDefinition<ZodObject<{ url: ZodString; }, "strip", ZodTypeAny, { url: string; }, { url: string; }>, 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; }>, { url: string; }, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>


jinaFetch()​

function jinaFetch(config?): BlockDefinition<ZodObject<{
url: ZodString;
}, "strip", ZodTypeAny, {
url: string;
}, {
url: string;
}>, 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;
}>, {
url: string;
}, {
markdown: string;
metadata: {
contentType: string;
description?: string;
publishedDate?: string;
statusCode: number;
wordCount: number;
};
source: "firecrawl" | "jina" | "builtin";
title: string;
url: string;
}>;

Parameters​

config?​

Omit<FetchConfig, "provider">

Returns​

BlockDefinition<ZodObject<{ url: ZodString; }, "strip", ZodTypeAny, { url: string; }, { url: string; }>, 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; }>, { url: string; }, { markdown: string; metadata: { contentType: string; description?: string; publishedDate?: string; statusCode: number; wordCount: number; }; source: "firecrawl" | "jina" | "builtin"; title: string; url: string; }>

References​

FetchConfig​

Re-exports FetchConfig


FetchInput​

Re-exports FetchInput


fetchInputSchema​

Re-exports fetchInputSchema


FetchProviderName​

Re-exports FetchProviderName


fetchProviders​

Re-exports fetchProviders


FetchResult​

Re-exports FetchResult


fetchResultSchema​

Re-exports fetchResultSchema