search-results changedbuild-with-claude/search-results
Nearest release: v2.1.307, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+10added
Lines−10removed
From line
1
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits11to this page, all time
The whole hunk
from line 1, old and new numbered
/
from line 1
11---
22title: Search results
33url: https://platform.claude.com/docs/en/build-with-claude/search-results
4description: Enable natural citations for RAG applications by providing search results with source attribution
4description: Get natural citations for RAG applications by providing search results with source attribution
55---
66
77<Note>
from line 16
1616
1717Search results can be provided in two ways:
1818
191. **From tool calls:** Your custom tools return search results, enabling dynamic RAG applications
202. **As top-level content:** You provide search results directly in user messages for pre-fetched or cached content
191. **From tool calls:** Your custom tools return search results, which lets you build dynamic RAG applications.
202. **As top-level content:** You provide search results directly in user messages for pre-fetched or cached content.
2121
2222In both cases, Claude cites the search results automatically when citations are enabled. No special prompting is needed: ask your question, and citations appear on the text blocks that draw on your content.
2323
from line 69
6969
7070## Method 1: Search results from tool calls
7171
72Returning search results from your custom tools enables dynamic RAG applications: tools fetch content at runtime, and Claude cites it in the response. The following example forces the tool call with [`tool_choice`](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use), so the retrieval step runs every time.
72Returning search results from your custom tools lets you build dynamic RAG applications: tools fetch content at runtime, and Claude cites it in the response. The following example forces the tool call with [`tool_choice`](https://platform.claude.com/docs/en/agents-and-tools/tool-use/define-tools#forcing-tool-use), so the retrieval step runs every time.
7373
7474### Example: Knowledge base tool
7575
7676<CodeGroup exclude="shell">
7777 <CodeGroupItem language="cURL">
78 The tool-calling flow needs search logic in your application, which needs more than a single shell command. Use the Claude SDK for the full flow. For the raw request shape of a tool conversation with search results, see [Combining both methods](https://platform.claude.com/docs/en/build-with-claude/search-results#combining-both-methods). For search results as top-level content, see [Method 2](https://platform.claude.com/docs/en/build-with-claude/search-results#method-2-search-results-as-top-level-content).
78 The tool-calling flow needs search logic in your application, which needs more than a single shell command. Use the Claude SDK for the full flow. For the raw request shape of a tool conversation with search results, see [Combining both methods](https://platform.claude.com/docs/en/build-with-claude/search-results#combining-both-methods). To provide search results directly in user messages, see [Method 2: Search results as top-level content](https://platform.claude.com/docs/en/build-with-claude/search-results#method-2-search-results-as-top-level-content).
7979 </CodeGroupItem>
8080
8181 <CodeGroupItem language="CLI">
82 The tool-calling flow needs search logic in your application, which needs more than a single shell command. Use the Claude SDK for the full flow. For the raw request shape of a tool conversation with search results, see [Combining both methods](https://platform.claude.com/docs/en/build-with-claude/search-results#combining-both-methods). For search results as top-level content, see [Method 2](https://platform.claude.com/docs/en/build-with-claude/search-results#method-2-search-results-as-top-level-content).
82 The tool-calling flow needs search logic in your application, which needs more than a single shell command. Use the Claude SDK for the full flow. For the raw request shape of a tool conversation with search results, see [Combining both methods](https://platform.claude.com/docs/en/build-with-claude/search-results#combining-both-methods). To provide search results directly in user messages, see [Method 2: Search results as top-level content](https://platform.claude.com/docs/en/build-with-claude/search-results#method-2-search-results-as-top-level-content).
8383 </CodeGroupItem>
8484
8585 ```python Python
from line 1124
11241124 client = Anthropic::Client.new
11251125
11261126 message = client.messages.create(
1127 model: "claude-opus-5-5",
1127 model: Anthropic::Model::CLAUDE_OPUS_5_5,
11281128 max_tokens: 1024,
11291129 messages: [
11301130 {
from line 1924
19241924 # Replay a conversation that provides search results both ways: the first
19251925 # user message carries a pre-fetched result, the tool result returns another
19261926 response = client.messages.create(
1927 model: "claude-opus-5-5",
1927 model: Anthropic::Model::CLAUDE_OPUS_5_5,
19281928 max_tokens: 1024,
19291929 tools: [knowledge_base_tool],
19301930 messages: [
from line 2095
20952095### For top-level search (Method 2)
20962096
20972097* **Pre-fetched content:** Use when you already have search results
2098* **Batch processing:** Ideal for processing multiple search results at once
2099* **Testing:** Great for testing citation behavior with known content
2098* **Batch processing:** Use for processing multiple search results at once
2099* **Testing:** Use for testing citation behavior with known content
21002100
21012101### General best practices
21022102
No line in this hunk matches that.