Skip to content

Conversation

genius-0963
Copy link

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.

- Updated firecrawl_search tool schema to accept both string format (["web"]) and object format ([{"type": "web"}])
- Added normalization logic to convert string formats to object format internally
- Updated documentation to show both supported formats
- Fixes HTTP 422 error when using string format for sources parameter
- Maintains backward compatibility with existing implementations

Resolves issue where requests with sources: ["web"] would fail with:
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"}]}
@nickscamara
Copy link
Member

Thank you! @genius-0963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants