d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
150 lines
4.1 KiB
TypeScript
150 lines
4.1 KiB
TypeScript
import type { MapParams, MapResponse } from '@/tools/firecrawl/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const mapTool: ToolConfig<MapParams, MapResponse> = {
|
|
id: 'firecrawl_map',
|
|
name: 'Firecrawl Map',
|
|
description:
|
|
'Get a complete list of URLs from any website quickly and reliably. Useful for discovering all pages on a site without crawling them.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
url: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'The base URL to map and discover links from (e.g., "https://example.com")',
|
|
},
|
|
search: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Filter results by relevance to a search term (e.g., "blog")',
|
|
},
|
|
sitemap: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Controls sitemap usage: "skip", "include" (default), or "only"',
|
|
},
|
|
includeSubdomains: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Whether to include URLs from subdomains (default: true)',
|
|
},
|
|
ignoreQueryParameters: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Exclude URLs containing query strings (default: true)',
|
|
},
|
|
limit: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'Maximum number of links to return (e.g., 100, 1000, 5000). Max: 100,000, default: 5,000',
|
|
},
|
|
timeout: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Request timeout in milliseconds',
|
|
},
|
|
location: {
|
|
type: 'json',
|
|
required: false,
|
|
visibility: 'hidden',
|
|
description: 'Geographic context for proxying (country, languages)',
|
|
},
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Firecrawl API key',
|
|
},
|
|
},
|
|
|
|
hosting: {
|
|
envKeyPrefix: 'FIRECRAWL_API_KEY',
|
|
apiKeyParam: 'apiKey',
|
|
byokProviderId: 'firecrawl',
|
|
pricing: {
|
|
type: 'custom',
|
|
getCost: (_params, output) => {
|
|
if (output.creditsUsed == null) {
|
|
throw new Error('Firecrawl response missing creditsUsed field')
|
|
}
|
|
|
|
const creditsUsed = Number(output.creditsUsed)
|
|
if (Number.isNaN(creditsUsed)) {
|
|
throw new Error('Firecrawl response returned a non-numeric creditsUsed field')
|
|
}
|
|
|
|
return {
|
|
cost: creditsUsed * 0.001,
|
|
metadata: { creditsUsed },
|
|
}
|
|
},
|
|
},
|
|
rateLimit: {
|
|
mode: 'per_request',
|
|
requestsPerMinute: 100,
|
|
},
|
|
},
|
|
|
|
request: {
|
|
method: 'POST',
|
|
url: 'https://api.firecrawl.dev/v2/map',
|
|
headers: (params) => ({
|
|
'Content-Type': 'application/json',
|
|
Authorization: `Bearer ${params.apiKey}`,
|
|
}),
|
|
body: (params) => {
|
|
const body: Record<string, any> = {
|
|
url: params.url,
|
|
}
|
|
|
|
if (params.search) body.search = params.search
|
|
if (params.sitemap) body.sitemap = params.sitemap
|
|
if (typeof params.includeSubdomains === 'boolean')
|
|
body.includeSubdomains = params.includeSubdomains
|
|
if (typeof params.ignoreQueryParameters === 'boolean')
|
|
body.ignoreQueryParameters = params.ignoreQueryParameters
|
|
if (params.limit) body.limit = Number(params.limit)
|
|
if (params.timeout) body.timeout = Number(params.timeout)
|
|
if (params.location) body.location = params.location
|
|
|
|
return body
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
return {
|
|
success: data.success,
|
|
output: {
|
|
success: data.success,
|
|
links: data.links || [],
|
|
creditsUsed: 1,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
success: {
|
|
type: 'boolean',
|
|
description: 'Whether the mapping operation was successful',
|
|
},
|
|
links: {
|
|
type: 'array',
|
|
description: 'Array of discovered URLs from the website',
|
|
items: {
|
|
type: 'string',
|
|
},
|
|
},
|
|
},
|
|
}
|