feat(gov): return law results with legal labels from firecrawl_gov_search

Draft
ER
1d ago
+63-4

firecrawl_gov_search now requests sources=law from /v2/search/gov and returns the law results. Each row in structuredContent.results keeps url, title, description and position, and also carries the Government Index's legal labels when the index has them: jurisdiction, court, court_type, cites, cited_as and updated_at.

The law group lists the same results in the same order as web, so the text block (## <position>. <title>, URL, snippet) reads exactly as before. The tool description, input schema and server instructions are unchanged. The output schema already allows extra fields on each row, so the contract snapshots don't change.

Draft until the API ships sources: https://github.com/firecrawl/firecrawl/pull/5354 adds sources and data.law to /v2/search/gov. Until that is deployed, the API rejects the sources parameter with a 400, so this PR must not merge before it.

Tests

  • tests/mcp-search-profile.test.mjs: the fake backend now answers with data.law. The test asserts that the request sends sources=law exactly once, that the text block is unchanged, and that structuredContent.results carries the labels.
  • Locally: tsc --noEmit, pnpm lint and the full pnpm test (225 pass) all pass.

Docs: https://github.com/firecrawl/firecrawl-docs/pull/1708.

Open in Capy


Summary by cubic

firecrawl_gov_search now requests sources=law from /v2/search/gov and returns the law results instead of the web results.

  • Each row in structuredContent.results keeps url, title, description and position, and carries the index's legal labels (jurisdiction, court, court_type, cites, cited_as, updated_at) when available.
  • The rendered text block stays identical, and the tool description, input schema, and output contract are unchanged.
  • Falls back to web results when the API ignores sources and only answers web.

Migration: Do not merge until the API supports sources (firecrawl/firecrawl#5354); if the API rejects the parameter with a 400, the fallback does not apply.