feat(scrape): expose knowledgeGraph format to agents#252
Open
beardfaceguy wants to merge 1 commit into
Open
Conversation
Surface the new knowledgeGraph format (added in the firecrawl API) so agents
can request it through the scrape/search/crawl tools.
- scrapeParamsSchema: add 'knowledgeGraph' to the formats enum and a
knowledgeGraphOptions param ({ entityTypes: string[].max(50) }).
- buildFormatsArray: map 'knowledgeGraph' to { type:'knowledgeGraph',
...knowledgeGraphOptions }, mirroring the json/query handling.
- transformScrapeParams: strip knowledgeGraphOptions after building.
- Tool description: document the format and add a usage example.
scrapeParamsSchema is shared by the scrape, search, and crawl tools, so this
covers all three. The bundled @mendable/firecrawl-js validator is permissive
toward unknown format types, so no SDK change is required.
1311d88 to
6fef27f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the
knowledgeGraphscrape format in the MCP server, mirroring howjson/queryformats are surfaced. Agents using the Firecrawl MCP server can now request entity/relationship graphs fromscrape,search, andcrawlcalls without bypassing the MCP layer.Structurally identical to #223 (audio format passthrough).
Companion API change
The API-side format itself is being discussed as an RFC in firecrawl/firecrawl#3684. This wrapper is intentionally minimal (just passthrough), and is safe to merge regardless of the decision on the API-side PR — the API will reject unknown formats, so this is a no-op until the API supports
knowledgeGraph.Changes (
src/index.ts)scrapeParamsSchema.formatsenum: added'knowledgeGraph'.knowledgeGraphOptionsparam:{ entityTypes: string[].max(50) }.buildFormatsArray: maps'knowledgeGraph'→{ type: 'knowledgeGraph', ...knowledgeGraphOptions }(mirrorsjson/queryhandling).transformScrapeParams: stripsknowledgeGraphOptionsafter building.Because
scrapeParamsSchemais shared, the search and crawl tools (scrapeOptions) pick this up for free.SDK note
The bundled
@mendable/firecrawl-js@4.24.0'sensureValidFormats()is permissive — unknown format types fall through unchanged. No SDK patch needed.Validation
pnpm run build: clean (tsc).Ada_LovelacewithentityTypes=['Person']→ 4 nodes / 3 edges, all typedPerson.CHANGELOG
Happy to add a
CHANGELOG.mdentry following the existing convention if you'd like — let me know your preference. Did not bumppackage.jsonversion (perVERSIONING.md, that triggers npm publish — maintainer's call).Made with Cursor