firecrawl-mcp-server
firecrawl-mcp-server copied to clipboard
fix: support both string and object formats for sources parameter
Bug Fix: Sources Parameter Schema Validation
Problem
The firecrawl_search tool had a mismatch between documentation and implementation:
-
Documentation showed
sourcesas an array of strings:["web"] -
Schema validation expected
sourcesas 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
sourcesparameter schema infirecrawl_searchtool - 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.
Thank you! @genius-0963