feat: add firecrawl_ask + firecrawl_docs_search tools#228
Open
devhims wants to merge 3 commits into
Open
Conversation
Two new MCP tools wrap the customer-facing /v2/support/* endpoints
(api.firecrawl.dev → support-agent proxy):
- firecrawl_ask: diagnose a failing or unexpected Firecrawl call. The AI
support agent inspects job logs, account state, credit usage, and the
docs, then returns a 2-4 sentence diagnosis plus machine-readable
fixParameters (often validated against the live API). Tool description
pushes agents to call this whenever ANY firecrawl_* tool returns an
error, empty result, or unexpected output — instead of guessing or
apologizing — and to apply the returned fixParameters when validation
succeeded.
- firecrawl_docs_search: answer "how do I…" questions from Firecrawl's
official documentation. Returns a concise, docs-grounded answer with
citations to the source pages. Tool description steers agents toward
this over generic web search for any Firecrawl-specific question
(parameters, endpoints, features, status codes, billing).
Both use the per-session FIRECRAWL_API_KEY as the bearer (same auth as
every other tool — calls are automatically scoped to the caller's team).
The SDK doesn't expose these endpoints yet, so a small callSupportEndpoint
helper does direct fetches to /v2/support/{ask,docs-search}, defaulting
to api.firecrawl.dev but honoring FIRECRAWL_API_URL when set.
Tool schemas mirror the upstream AskRequestSchema (post-cleanup):
question/rationale/jobId/context only — no model, maxSteps, or firecrawl
creds overrides. Tool descriptions follow the existing Best for / Not
recommended / Common mistakes / Recipe / Returns pattern used by
firecrawl_scrape and firecrawl_search.
README.md: add the two tools to the Quick Reference Table and full
sections in Available Tools (renumbering the subsequent deprecated
browser sections to 13-16).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ch tools The publish workflow only fires on a push to main where package.json is in the diff (.github/workflows/publish.yml: paths: package.json), so the two new tools wouldn't actually deploy without a version bump. Minor bump since this is a feature add with no breaking changes. Also sync server.json's version to 3.16.0 — it had drifted to 3.7.4 well behind the npm package, and the publish workflow runs `mcp-publisher publish` against server.json after the npm push, so the registry record needs the same version to stay aligned with what gets published to npm. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9 tasks
Companion to support-agent dropping usage from the /v2/support/ask response envelope. Update both the tool's runtime description (which agents read at call time to know what fields to expect) and the README section so they don't promise a `usage` field that's no longer there. Only firecrawl_ask is affected — firecrawl_docs_search still returns its own usage, which is a different envelope shape. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two new MCP tools wrap the customer-facing
/v2/support/*endpoints exposed atapi.firecrawl.dev(which proxies to the support-agent service):firecrawl_askfirecrawl_*call failed, returned an empty result, or behaved unexpectedly. The AI support agent inspects job logs + account state + docs and returns a diagnosis with machine-readablefixParametersyou can apply directly.firecrawl_docs_searchBoth auth automatically with the per-session
FIRECRAWL_API_KEY— same as every other tool, calls are team-scoped server-side.Why this matters for agents
Today, when a
firecrawl_scrape/firecrawl_crawl/etc. call fails or returns weird output, agents typically:After this PR, the right move is
firecrawl_ask— the support agent inspects the actual run's logs, often validates a fix against the live API, and returns the corrected parameters as JSON the calling agent can apply directly. The tool descriptions push agents toward this loop explicitly:firecrawl_docs_searchsolves the parallel problem on the learning side — instead of returning out-of-date answers from training data when the user asks "how do webhooks work in Firecrawl?", agents now have a tool that grounds the answer in the current docs.Implementation
src/index.ts:callSupportEndpoint(session, endpoint, body)helper near the existingasText()utility — POSTs directly to/v2/support/*with the session's API key (the SDK doesn't expose these yet). Defaults tohttps://api.firecrawl.devbut honorsFIRECRAWL_API_URLwhen set, so self-hosted-with-proxy deployments work.server.addTool({...})registrations afterfirecrawl_interact_stop:firecrawl_ask— schema:question(1-8000 chars, required) + optionalrationale(1-2000),jobId,context. Mirrors the upstreamAskRequestSchemapost-cleanup (nomodel/maxSteps/firecrawlApi*knobs).firecrawl_docs_search— schema:question(1-8000 chars, required) only.readOnlyHint: true, openWorldHint: falseannotations and the same Best-for / Not-recommended / Common-mistakes / Recipe / Returns description pattern asfirecrawl_scrapeandfirecrawl_search.README.md:askanddocs_searchrows.Testing the change
After this lands, in any MCP client (Claude Desktop, Cursor, etc.):
Should return a
{ requestId, answer, confidence, fixParameters, validation, … }envelope from the support agent within ~15-30 seconds.Should return
{ answer, evidence: [{ pathOrUrl, reason }], … }with citations to the relevant docs pages.Test plan
pnpm install && pnpm buildfirecrawl_askreturns a valid envelope when called with a real failing job id from the user's teamfirecrawl_docs_searchreturns docs-grounded results with citationsFIRECRAWL_API_KEYis missingFIRECRAWL_API_URLoverride is honored (self-hosted proxy scenario)Companion changes
/v2/support/askfrom the playground Debug Issue modal.AskRequestSchema(dropsmodel,maxSteps,firecrawlApi*)./support/*out of the Elixir SDK source-of-truth.🤖 Generated with Claude Code