Skip to main content
Glama
mcma123

Firecrawl MCP Server

by mcma123

firecrawl_search

Search web content and retrieve results, with options to scrape full page content in multiple formats for data extraction.

Instructions

Search and retrieve content from web pages with optional scraping. Returns SERP results by default (url, title, description) or full page content when scrapeOptions are provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query string
limitNoMaximum number of results to return (default: 5)
langNoLanguage code for search results (default: en)
countryNoCountry code for search results (default: us)
tbsNoTime-based search filter
filterNoSearch filter
locationNoLocation settings for search
scrapeOptionsNoOptions for scraping search results

Implementation Reference

  • Defines the Tool object for 'firecrawl_search' including name, description, and detailed inputSchema for search parameters and optional scraping options.
    const SEARCH_TOOL: Tool = {
      name: 'firecrawl_search',
      description:
        'Search and retrieve content from web pages with optional scraping. ' +
        'Returns SERP results by default (url, title, description) or full page content when scrapeOptions are provided.',
      inputSchema: {
        type: 'object',
        properties: {
          query: {
            type: 'string',
            description: 'Search query string',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results to return (default: 5)',
          },
          lang: {
            type: 'string',
            description: 'Language code for search results (default: en)',
          },
          country: {
            type: 'string',
            description: 'Country code for search results (default: us)',
          },
          tbs: {
            type: 'string',
            description: 'Time-based search filter',
          },
          filter: {
            type: 'string',
            description: 'Search filter',
          },
          location: {
            type: 'object',
            properties: {
              country: {
                type: 'string',
                description: 'Country code for geolocation',
              },
              languages: {
                type: 'array',
                items: { type: 'string' },
                description: 'Language codes for content',
              },
            },
            description: 'Location settings for search',
          },
          scrapeOptions: {
            type: 'object',
            properties: {
              formats: {
                type: 'array',
                items: {
                  type: 'string',
                  enum: ['markdown', 'html', 'rawHtml'],
                },
                description: 'Content formats to extract from search results',
              },
              onlyMainContent: {
                type: 'boolean',
                description: 'Extract only the main content from results',
              },
              waitFor: {
                type: 'number',
                description: 'Time in milliseconds to wait for dynamic content',
              },
            },
            description: 'Options for scraping search results',
          },
        },
        required: ['query'],
      },
    };
  • Handler for firecrawl_search tool: validates args with isSearchOptions, calls client.search via withRetry, handles credits, formats SERP results with optional scraped content into text response.
          case 'firecrawl_search': {
            if (!isSearchOptions(args)) {
              throw new Error('Invalid arguments for firecrawl_search');
            }
            try {
              const response = await withRetry(
                async () => client.search(args.query, args),
                'search operation'
              );
    
              if (!response.success) {
                throw new Error(
                  `Search failed: ${response.error || 'Unknown error'}`
                );
              }
    
              // Monitor credits for cloud API
              if (!FIRECRAWL_API_URL && hasCredits(response)) {
                await updateCreditUsage(response.creditsUsed);
              }
    
              // Format the results
              const results = response.data
                .map(
                  (result) =>
                    `URL: ${result.url}
    Title: ${result.title || 'No title'}
    Description: ${result.description || 'No description'}
    ${result.markdown ? `\nContent:\n${result.markdown}` : ''}`
                )
                .join('\n\n');
    
              return {
                content: [{ type: 'text', text: results }],
                isError: false,
              };
            } catch (error) {
              const errorMessage =
                error instanceof Error
                  ? error.message
                  : `Search failed: ${JSON.stringify(error)}`;
              return {
                content: [{ type: 'text', text: errorMessage }],
                isError: true,
              };
            }
          }
  • src/index.ts:862-874 (registration)
    Registers the firecrawl_search tool (as SEARCH_TOOL) in the list of available tools returned by ListToolsRequestSchema.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        SCRAPE_TOOL,
        MAP_TOOL,
        CRAWL_TOOL,
        BATCH_SCRAPE_TOOL,
        CHECK_BATCH_STATUS_TOOL,
        CHECK_CRAWL_STATUS_TOOL,
        SEARCH_TOOL,
        EXTRACT_TOOL,
        DEEP_RESEARCH_TOOL,
      ],
    }));
  • Type guard function isSearchOptions used to validate input arguments for firecrawl_search handler.
    function isSearchOptions(args: unknown): args is SearchOptions {
      return (
        typeof args === 'object' &&
        args !== null &&
        'query' in args &&
        typeof (args as { query: unknown }).query === 'string'
      );
    }
  • TypeScript interface SearchOptions defining the shape of arguments expected by firecrawl_search.
    interface SearchOptions {
      query: string;
      limit?: number;
      lang?: string;
      country?: string;
      tbs?: string;
      filter?: string;
      location?: {
        country?: string;
        languages?: string[];
      };
      scrapeOptions?: {
        formats?: string[];
        onlyMainContent?: boolean;
        waitFor?: number;
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the dual-mode behavior (SERP vs. full content scraping) and mentions optional scraping, which is helpful. However, it lacks details about rate limits, authentication needs, error handling, or what happens when scrapeOptions are omitted versus provided - important for a web scraping tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly concise - two sentences that front-load the core functionality and clearly explain the dual output modes. Every word earns its place with zero redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with 8 parameters, nested objects, and no output schema, the description provides adequate context about what the tool does and its dual modes. However, with no annotations and no output schema, it should ideally mention more about behavioral aspects like rate limits, authentication, or error handling to be fully complete for this level of complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 8 parameters thoroughly. The description adds some value by explaining the relationship between scrapeOptions and output behavior, but doesn't provide additional semantic context beyond what's in the schema descriptions. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('search and retrieve content from web pages') and distinguishes it from siblings by specifying it returns SERP results by default or full content with scraping. It explicitly differentiates from tools like firecrawl_scrape and firecrawl_extract by focusing on search-first functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (search with optional scraping) and implies alternatives by mentioning 'SERP results by default' versus 'full page content when scrapeOptions are provided'. However, it doesn't explicitly name when to use this versus siblings like firecrawl_scrape or firecrawl_extract, which would require more specific guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcma123/firecrawl-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server