search
Search the web and extract content as markdown with links using the Firecrawl API, enabling web content retrieval for analysis or processing.
Instructions
Searches the web using the Firecrawl search API and scrapes results in markdown and link formats by default.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query string | |
| limit | No | Maximum number of results to return. |
Implementation Reference
- The 'search' tool handler within call_tool, which uses the firecrawl_client to perform web searches.
if name == "search": try: args = Search(**arguments) except ValueError as e: raise McpError(ErrorData(code=INVALID_PARAMS, message=str(e))) try: if firecrawl_client is None: raise McpError(ErrorData(code=INTERNAL_ERROR, message="Firecrawl client is not initialised")) # Firecrawl v2: search(query, options?) with limit and scrapeOptions result = await firecrawl_client.search( args.query, options={"limit": args.limit, "scrapeOptions": {"formats": ["markdown", "links"]}}, ) except Exception as e: raise McpError(ErrorData(code=INTERNAL_ERROR, message=f"Failed to search via Firecrawl SDK: {e!r}")) try: json_text = result.model_dump_json() except AttributeError: json_text = json.dumps(result) return [TextContent(type="text", text=json_text)] - Pydantic model defining the input schema for the 'search' tool.
class Search(BaseModel): """Parameters for searching using Firecrawl search API.""" query: Annotated[str, Field(description="Search query string")] limit: Annotated[int, Field(default=10, description="Maximum number of results to return.", ge=1)] - src/mcp_server_multi_fetch/server.py:247-252 (registration)Registration of the 'search' tool in the list_tools function.
Tool( name="search", description="""Searches the web using the Firecrawl search API and scrapes results in markdown and link formats by default.""", inputSchema=Search.model_json_schema(), ), ]