Skip to content

feat: add firecrawl_ask + firecrawl_docs_search tools#228

Open
devhims wants to merge 3 commits into
mainfrom
feat/support-ask-and-docs-search
Open

feat: add firecrawl_ask + firecrawl_docs_search tools#228
devhims wants to merge 3 commits into
mainfrom
feat/support-ask-and-docs-search

Conversation

@devhims

@devhims devhims commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Two new MCP tools wrap the customer-facing /v2/support/* endpoints exposed at api.firecrawl.dev (which proxies to the support-agent service):

Tool Use when
firecrawl_ask Debugging — a firecrawl_* 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-readable fixParameters you can apply directly.
firecrawl_docs_search Learning — "how do I…" questions about Firecrawl features, parameters, endpoints, status codes, billing. Returns a docs-grounded answer with citations.

Both 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:

  1. Apologize and tell the user to file a support ticket, or
  2. Guess at fixes based on stale training data and burn credits on retries.

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:

Best for: Debugging a failing or unexpected Firecrawl call. Use this WHENEVER another firecrawl_* tool returns an error, an empty result, or output that doesn't match what the user asked for — instead of guessing or apologizing, call firecrawl_ask first and apply the suggested fix.

firecrawl_docs_search solves 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:

  • New callSupportEndpoint(session, endpoint, body) helper near the existing asText() utility — POSTs directly to /v2/support/* with the session's API key (the SDK doesn't expose these yet). Defaults to https://api.firecrawl.dev but honors FIRECRAWL_API_URL when set, so self-hosted-with-proxy deployments work.
  • Two new server.addTool({...}) registrations after firecrawl_interact_stop:
    • firecrawl_ask — schema: question (1-8000 chars, required) + optional rationale (1-2000), jobId, context. Mirrors the upstream AskRequestSchema post-cleanup (no model / maxSteps / firecrawlApi* knobs).
    • firecrawl_docs_search — schema: question (1-8000 chars, required) only.
  • Both tools use the existing readOnlyHint: true, openWorldHint: false annotations and the same Best-for / Not-recommended / Common-mistakes / Recipe / Returns description pattern as firecrawl_scrape and firecrawl_search.

README.md:

Testing the change

After this lands, in any MCP client (Claude Desktop, Cursor, etc.):

firecrawl_ask({
  "question": "scrape of https://example.com returned empty markdown",
  "rationale": "User wants to scrape example.com to feed an LLM summarization pipeline.",
  "jobId": "scrape-abc-123-def"
})

Should return a { requestId, answer, confidence, fixParameters, validation, … } envelope from the support agent within ~15-30 seconds.

firecrawl_docs_search({
  "question": "how do I verify webhook signatures?"
})

Should return { answer, evidence: [{ pathOrUrl, reason }], … } with citations to the relevant docs pages.

Test plan

  • Build clean: pnpm install && pnpm build
  • firecrawl_ask returns a valid envelope when called with a real failing job id from the user's team
  • firecrawl_docs_search returns docs-grounded results with citations
  • Both tools surface clear errors when FIRECRAWL_API_KEY is missing
  • FIRECRAWL_API_URL override is honored (self-hosted proxy scenario)

Companion changes

  • firecrawl-web#2096 — uses /v2/support/ask from the playground Debug Issue modal.
  • support-agent#4 — tightens the customer-facing AskRequestSchema (drops model, maxSteps, firecrawlApi*).
  • firecrawl-docs#917 — keeps /support/* out of the Elixir SDK source-of-truth.

🤖 Generated with Claude Code

devhims and others added 2 commits May 7, 2026 19:34
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>
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>
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