feat(firecrawl): add search tool support#3260
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a new "Search" tool to the Firecrawl plugin, enabling web searching and optional scraping of results. It implements the SearchTool class, updates the FirecrawlApp client to support the /v2/search endpoint, defines the tool configuration in YAML, and adds comprehensive tests. The feedback suggests safely retrieving the required query parameter using .get() to avoid potential KeyError exceptions during tool invocation.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| payload["scrapeOptions"] = scrape_options or None | ||
| payload = {k: v for (k, v) in payload.items() if v not in (None, "")} | ||
|
|
||
| search_result = app.search(query=tool_parameters["query"], **payload) |
There was a problem hiding this comment.
Using direct dictionary access tool_parameters["query"] can raise a KeyError if the query parameter is missing or omitted during invocation. It is safer to use defensive programming and fetch it with .get("query") or raise a descriptive error.
| search_result = app.search(query=tool_parameters["query"], **payload) | |
| query = tool_parameters.get("query") | |
| if not query: | |
| raise ValueError("The 'query' parameter is required and cannot be empty.") | |
| search_result = app.search(query=query, **payload) |
|
Please resolve the conflicts :) |
Summary
Add Firecrawl Search API support to the Firecrawl tool plugin.
This change adds a new
searchtool backed by Firecrawl v2POST /search, allowing users to search the web and optionally scrape returned search results throughscrapeOptions.Included changes:
FirecrawlApp.search()forPOST /v2/searchtools/search.pyimplementationtools/search.yamltool definitionprovider/firecrawl.yamlChange Type
Screenshots / Videos
N/A — this is a tool/API integration change. No UI screenshots were captured.
/search.LLM Plugin Checklist
N/A — this is a Non-LLM tool plugin change.
Areas affected by this change (check all that apply)
Version
versioninmanifest.yaml(not the one undermeta)dify_plugin>=0.3.0,<0.6.0is declared inpyproject.tomland locked inuv.lock(or kept inrequirements.txtfor legacy plugins withoutuv.lock) — SDK docsNote: No dependency changes were made. The existing Firecrawl plugin currently declares
dify_plugin>=0.9.0.Testing
Focused local verification was performed from
tools/firecrawl:Result:
The warnings are from existing
dify_plugindependency behavior (geventmonkey patch / Pydantic deprecation), not from this change.Additional checks:
Result:
Result:
YAML parsing was also verified for:
Static security scan of added lines: