search
Search the web and retrieve markdown-formatted results and links using the Firecrawl API. Specify a search query and limit the number of results.
Instructions
Searches the web using the Firecrawl search API and scrapes results in markdown and link formats by default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query string | |
| limit | No | Maximum number of results to return. |
Implementation Reference
- Pydantic model defining the input schema for the 'search' tool: query (required string) and limit (optional int, default 10).
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() handler, with name='search', description, and Search.model_json_schema() as inputSchema.
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(), ), ] - The call_tool handler for 'search': validates arguments via Search model, calls firecrawl_client.search() with the query and options (limit, scrapeOptions with markdown+links formats), returns JSON result.
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)] - src/mcp_server_multi_fetch/server.py:277-284 (registration)Registration of the 'search' prompt in the list_prompts() handler (prompt variant of the search tool).
Prompt( name="search", description="Search the web using the Firecrawl search API", arguments=[ PromptArgument(name="query", description="Search query string", required=True), PromptArgument(name="limit", description="Maximum number of results to return", required=False), ], ),