Add a scrape tool for reading one page by erikengervall · Pull Request #7 · firecrawl/opencode-firecrawl · GitHub
Skip to content

Add a scrape tool for reading one page - #7

Open
erikengervall wants to merge 1 commit into
mainfrom
scrape-tool
Open

erikengervall wants to merge 1 commit into
mainfrom
scrape-tool

Conversation

@erikengervall

Copy link
Copy Markdown
Contributor

Adds firecrawl_scrape, so the agent can read a page it already has the URL for without installing the Firecrawl CLI.

  • scrape.ts posts to /v2/scrape with the same key, _opencode integration tag, and abort and timeout handling as Alexandria. It takes url, formats (markdown, html, links, json), jsonPrompt, and onlyMainContent. json is sent as { type: "json", prompt } and is refused before any request when jsonPrompt is missing.
  • Markdown, html, links, and json are rendered into the tool output; a target page answering 4xx or 5xx gets a one-line note, and API failures report status and error detail.
  • Registered on OpenCode 1 and OpenCode 2 next to Alexandria. Scrapes spend credits, so like Alexandria the tool appears only once Firecrawl is connected, and connecting or disconnecting mid-session adds or removes it.
  • README documents the tool; version goes to 1.5.0 and scrape.ts joins the published files.

Testing

  • npm run check passes.
  • The repo has no test runner, so I checked behaviour with a throwaway script and a mocked fetch (not committed): request body and auth header, json prompt mapping, rendering, the 404 note, API errors with and without a JSON body, the missing jsonPrompt guard, input validation, and that both OpenCode 1 and OpenCode 2 register the tool only with a key.

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.

1 participant