firecrawl-mcp-server icon indicating copy to clipboard operation
firecrawl-mcp-server copied to clipboard

fix: support both string and object formats for sources parameter

Open genius-0963 opened this issue 4 months ago • 1 comments

Bug Fix: Sources Parameter Schema Validation

Problem

The firecrawl_search tool had a mismatch between documentation and implementation:

  • Documentation showed sources as an array of strings: ["web"]
  • Schema validation expected sources as an array of objects: [{type: "web"}]

This caused HTTP 422 errors when using the string format:

{
  "error": "HTTP error 422: {\"detail\":[{\"type\":\"model_attributes_type\",\"loc\":[\"body\",\"sources\",0],\"msg\":\"Input should be a valid dictionary or object to extract fields from\",\"input\":\"web\"}]}"
}

Solution

  • Updated the Zod schema to accept both string and object formats using a union type
  • Added normalization logic to convert string formats to object format internally
  • Updated documentation to clearly show both supported formats
  • Maintains backward compatibility with existing implementations

Changes

  • Modified sources parameter schema in firecrawl_search tool
  • Added normalization logic in the execute function
  • Updated tool description and examples

Testing

✅ Both formats now work correctly:

  • String format: sources: ["web"]
  • Object format: sources: [{"type": "web"}]

Backward Compatibility

This change is fully backward compatible - existing code using either format will continue to work.

genius-0963 avatar Sep 13 '25 12:09 genius-0963

Thank you! @genius-0963

nickscamara avatar Sep 16 '25 19:09 nickscamara