Skip to content

Commit 3334dfe

Browse files
authored
fix(firecrawl): updated output for firecrawl extract (#2333)
* fix(firecrawl): fixed optional params for firecrawl * fix(build): fixed firecrawl tools * ack PR comments
1 parent cb9b881 commit 3334dfe

File tree

7 files changed

+9
-35
lines changed

7 files changed

+9
-35
lines changed

apps/docs/content/docs/en/tools/firecrawl.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ Extract structured data from entire webpages using natural language prompts and
148148
| --------- | ---- | ----------- |
149149
| `success` | boolean | Whether the extraction operation was successful |
150150
| `data` | object | Extracted structured data according to the schema or prompt |
151-
| `sources` | array | Data sources \(only if showSources is enabled\) |
152151

153152

154153

apps/sim/tools/firecrawl/crawl.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ export const crawlTool: ToolConfig<FirecrawlCrawlParams, FirecrawlCrawlResponse>
6565
if (typeof params.allowSubdomains === 'boolean') body.allowSubdomains = params.allowSubdomains
6666
if (typeof params.ignoreQueryParameters === 'boolean')
6767
body.ignoreQueryParameters = params.ignoreQueryParameters
68-
if (params.delay != null && params.delay !== '') body.delay = Number(params.delay)
69-
if (params.maxConcurrency != null && params.maxConcurrency !== '')
70-
body.maxConcurrency = Number(params.maxConcurrency)
68+
if (params.delay) body.delay = Number(params.delay)
69+
if (params.maxConcurrency) body.maxConcurrency = Number(params.maxConcurrency)
7170
if (params.excludePaths) body.excludePaths = params.excludePaths
7271
if (params.includePaths) body.includePaths = params.includePaths
7372
if (params.webhook) body.webhook = params.webhook

apps/sim/tools/firecrawl/extract.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ export const extractTool: ToolConfig<ExtractParams, ExtractResponse> = {
162162
jobId,
163163
success: true,
164164
data: extractData.data || {},
165-
warning: extractData.warning,
166165
}
167166
return result
168167
}
@@ -210,20 +209,5 @@ export const extractTool: ToolConfig<ExtractParams, ExtractResponse> = {
210209
type: 'object',
211210
description: 'Extracted structured data according to the schema or prompt',
212211
},
213-
sources: {
214-
type: 'array',
215-
description: 'Data sources (only if showSources is enabled)',
216-
items: {
217-
type: 'object',
218-
properties: {
219-
url: { type: 'string', description: 'Source URL' },
220-
title: { type: 'string', description: 'Source title' },
221-
},
222-
},
223-
},
224-
warning: {
225-
type: 'string',
226-
description: 'Warning messages from the extraction operation',
227-
},
228212
},
229213
}

apps/sim/tools/firecrawl/map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ export const mapTool: ToolConfig<MapParams, MapResponse> = {
8383
body.includeSubdomains = params.includeSubdomains
8484
if (typeof params.ignoreQueryParameters === 'boolean')
8585
body.ignoreQueryParameters = params.ignoreQueryParameters
86-
if (params.limit != null && params.limit !== '') body.limit = Number(params.limit)
87-
if (params.timeout != null && params.timeout !== '') body.timeout = Number(params.timeout)
86+
if (params.limit) body.limit = Number(params.limit)
87+
if (params.timeout) body.timeout = Number(params.timeout)
8888
if (params.location) body.location = params.location
8989

9090
return body

apps/sim/tools/firecrawl/scrape.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ export const scrapeTool: ToolConfig<ScrapeParams, ScrapeResponse> = {
4545
if (typeof params.onlyMainContent === 'boolean') body.onlyMainContent = params.onlyMainContent
4646
if (params.includeTags) body.includeTags = params.includeTags
4747
if (params.excludeTags) body.excludeTags = params.excludeTags
48-
if (params.maxAge != null && params.maxAge !== '') body.maxAge = Number(params.maxAge)
48+
if (params.maxAge) body.maxAge = Number(params.maxAge)
4949
if (params.headers) body.headers = params.headers
50-
if (params.waitFor != null && params.waitFor !== '') body.waitFor = Number(params.waitFor)
50+
if (params.waitFor) body.waitFor = Number(params.waitFor)
5151
if (typeof params.mobile === 'boolean') body.mobile = params.mobile
5252
if (typeof params.skipTlsVerification === 'boolean')
5353
body.skipTlsVerification = params.skipTlsVerification
54-
if (params.timeout != null && params.timeout !== '') body.timeout = Number(params.timeout)
54+
if (params.timeout) body.timeout = Number(params.timeout)
5555
if (params.parsers) body.parsers = params.parsers
5656
if (params.actions) body.actions = params.actions
5757
if (params.location) body.location = params.location

apps/sim/tools/firecrawl/search.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ export const searchTool: ToolConfig<SearchParams, SearchResponse> = {
3535
}
3636

3737
// Add optional parameters if provided (truthy check filters empty strings, null, undefined)
38-
if (params.limit != null && params.limit !== '') body.limit = Number(params.limit)
38+
if (params.limit) body.limit = Number(params.limit)
3939
if (params.sources) body.sources = params.sources
4040
if (params.categories) body.categories = params.categories
4141
if (params.tbs) body.tbs = params.tbs
4242
if (params.location) body.location = params.location
4343
if (params.country) body.country = params.country
44-
if (params.timeout != null && params.timeout !== '') body.timeout = Number(params.timeout)
44+
if (params.timeout) body.timeout = Number(params.timeout)
4545
if (typeof params.ignoreInvalidURLs === 'boolean')
4646
body.ignoreInvalidURLs = params.ignoreInvalidURLs
4747
if (params.scrapeOptions) body.scrapeOptions = params.scrapeOptions
@@ -57,7 +57,6 @@ export const searchTool: ToolConfig<SearchParams, SearchResponse> = {
5757
success: true,
5858
output: {
5959
data: data.data,
60-
warning: data.warning,
6160
},
6261
}
6362
},
@@ -81,6 +80,5 @@ export const searchTool: ToolConfig<SearchParams, SearchResponse> = {
8180
},
8281
},
8382
},
84-
warning: { type: 'string', description: 'Warning messages from the search operation' },
8583
},
8684
}

apps/sim/tools/firecrawl/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ export interface SearchResponse extends ToolResponse {
163163
error?: string
164164
}
165165
}>
166-
warning?: string
167166
}
168167
}
169168

@@ -198,11 +197,6 @@ export interface ExtractResponse extends ToolResponse {
198197
jobId: string
199198
success: boolean
200199
data: Record<string, any>
201-
sources?: Array<{
202-
url: string
203-
title?: string
204-
}>
205-
warning?: string
206200
}
207201
}
208202

0 commit comments

Comments
 (0)