packages/provider-claude is one of three answer-visibility provider adapters (alongside Gemini and OpenAI). It queries the Anthropic Messages API with web search enabled to determine which domains are cited in AI-generated answers for tracked keywords.
validateConfig(config: ClaudeConfig): ClaudeHealthcheckResultValidates that the config has a non-empty API key. Returns the model name that will be used.
healthcheck(config: ClaudeConfig): Promise<ClaudeHealthcheckResult>Makes a lightweight Anthropic API call to verify the key works. Returns ok/error with a message.
executeTrackedQuery(input: ClaudeTrackedQueryInput): Promise<ClaudeRawResult>Sends the keyword to the Anthropic Messages API with web_search_20250305 tool enabled (max_uses: 5). The keyword is sent as-is. Returns:
rawResponse — the full Anthropic API response (content blocks, usage metadata)groundingSources — extracted { uri, title } pairs from web_search_tool_result blockssearchQueries — search queries extracted from server_tool_use blocks where name === 'web_search'model — the model used (default: claude-sonnet-4-20250514)normalizeResult(raw: ClaudeRawResult): ClaudeNormalizedResultExtracts analyst-relevant fields from the raw response:
answerText — concatenated text from text content blockscitedDomains — unique domains extracted from web search result URLs (www. stripped)groundingSources — pass-through of { uri, title } pairssearchQueries — pass-through of search queries usedDefault: claude-sonnet-4-20250514. Configurable via ClaudeConfig.model.
The provider uses Anthropic’s web search tool (web_search_20250305). When enabled, the Messages API:
server_tool_use blocks (with name: 'web_search' and input.query)web_search_tool_result content blocks containing web_search_result items with URLs and titlesCitation detection works by extracting domains from the search result URLs in web_search_tool_result blocks. The job runner then matches these against the project’s canonical domain and competitor domains to determine citation state.
new URL()www. prefix is strippedQuota policy is passed via ClaudeConfig.quotaPolicy but enforcement is handled by the job runner (not the provider itself).
The job runner stores the following in query_snapshots.raw_response as JSON:
{
"model": "claude-sonnet-4-20250514",
"groundingSources": [
{ "uri": "https://example.com/page", "title": "Page Title" }
],
"searchQueries": ["keyword related search"],
"apiResponse": { "content": [...] }
}
Phase 2: Live Anthropic API calls implemented with Messages API web search. The @anthropic-ai/sdk SDK is used for API communication.