---
title: Suchergebnisse
url: https://platform.claude.com/docs/de/build-with-claude/search-results
description: Erhalte natürliche Zitate für RAG-Anwendungen, indem du Suchergebnisse mit Quellenangabe bereitstellst
featureMetadata:
  status: stable
  zdr:
    eligibility: eligible
    note: Excludes [Covered Models](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements).
  supportedModels:
    - claude-fable-5-2
    - claude-mythos-5-2
    - claude-fable-5-1
    - claude-mythos-5-1
    - claude-fable-5
    - claude-mythos-5
    - claude-mythos-preview
    - claude-opus-5-5
    - claude-opus-5
    - claude-sonnet-5-5
    - claude-sonnet-5
    - claude-haiku-5-5
    - claude-haiku-4-5-20251001
    - claude-opus-4-8
    - claude-opus-4-7
    - claude-opus-4-6
    - claude-sonnet-4-6
    - claude-opus-4-5-20251101
    - claude-sonnet-4-5-20250929
  supportedPlatforms:
    Claude API: stable
    Amazon Bedrock: stable
    Amazon Bedrock (bedrock-runtime): stable
    Claude Platform on AWS: stable
    Claude Models on Google Cloud (Anthropic managed): stable
    Claude Models on Google Cloud (Google managed): stable
    Microsoft Foundry: stable
---

**API-Unterstützung**: Nutzung unterscheidet sich je nach Produkt.

* **Messages API**: Sende `search_result`-Blöcke in einem Tool-Ergebnis oder direkt in einer Benutzernachricht.
* **Managed Agents**: Nur in Tool-Ergebnissen akzeptiert, etwa in einem Event `user.custom_tool_result`, nicht in Events `user.message`.

„Search result content blocks“ (Suchergebnis-Inhaltsblöcke) ermöglichen es Claude, deine eigenen Inhalte genauso zu zitieren wie Websuchergebnisse: Jedes Zitat enthält die Quelle und den Titel, die du angegeben hast. Verwende sie in Anwendungen mit „Retrieval-Augmented Generation“ (abrufgestützter Generierung), oder RAG, bei denen Claude Antworten deinen Dokumenten zuordnen muss.

## Funktionsweise

Suchergebnisse können auf zwei Arten bereitgestellt werden:

1. **Aus Tool-Aufrufen:** Deine benutzerdefinierten Tools geben Suchergebnisse zurück, wodurch du dynamische RAG-Anwendungen erstellen kannst.
2. **Als Inhalt auf oberster Ebene:** Du stellst Suchergebnisse direkt in Benutzernachrichten für vorab abgerufene oder zwischengespeicherte Inhalte bereit.

In beiden Fällen zitiert Claude die Suchergebnisse automatisch, wenn Zitate aktiviert sind. Es ist kein spezielles Prompting erforderlich: Stelle deine Frage, und die Zitate erscheinen an den Textblöcken, die sich auf deine Inhalte stützen. Wenn dein Prompt jedoch ausschließlich JSON anfordert, enthält die Antwort möglicherweise nur wenige oder gar keine Zitate. Um strukturierte Daten mit einem Zitat für jeden Wert zu extrahieren, siehe [Strukturierte Daten mit Citations erhalten](https://platform.claude.com/docs/de/build-with-claude/citations#get-structured-data-with-citations).

### Schema für Suchergebnisse

Suchergebnisse verwenden die folgende Struktur:

```json
{
  "type": "search_result",
  "source": "https://example.com/article", // Required: Source URL or identifier
  "title": "Article Title", // Required: Title of the result
  "content": [
    // Required: Array of text blocks
    {
      "type": "text",
      "text": "The actual content of the search result..."
    }
  ],
  "citations": {
    // Optional: Citation configuration
    "enabled": true // Enable/disable citations for this result
  }
}
```

### Pflichtfelder

| Feld      | Typ    | Beschreibung                                                                                                          |
| --------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| `type`    | string | Muss `"search_result"` sein                                                                                           |
| `source`  | string | Die Quelle des Inhalts. Jeder stabile String funktioniert: eine URL oder eine interne Kennung wie `kb://article-1234` |
| `title`   | string | Ein aussagekräftiger Titel für das Suchergebnis                                                                       |
| `content` | array  | Ein Array von Textblöcken, die den eigentlichen Inhalt enthalten                                                      |

### Optionale Felder

| Feld            | Typ    | Beschreibung                                                                                                                                                                                                                                                                                                                                              |
| --------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `citations`     | object | Zitatkonfiguration mit dem booleschen Feld `enabled`. Zitate sind standardmäßig deaktiviert; jedes Beispiel auf dieser Seite setzt `"enabled": true` explizit. Alle Suchergebnisse in einer Anfrage müssen dieselbe Einstellung verwenden (siehe [Zitatsteuerung](https://platform.claude.com/docs/de/build-with-claude/search-results#citation-control)) |
| `cache_control` | object | Cache-Steuerungseinstellungen (zum Beispiel `{"type": "ephemeral"}`)                                                                                                                                                                                                                                                                                      |

Jedes Element im `content`-Array muss ein Textblock sein mit:

* `type`: Muss `"text"` sein
* `text`: Der eigentliche Textinhalt (nicht leerer String)

Suchergebnisse enthalten nur Text. Bilder und andere Medien werden im `content`-Array nicht unterstützt.

## Methode 1: Suchergebnisse aus Tool-Aufrufen

Wenn du Suchergebnisse aus deinen benutzerdefinierten Tools zurückgibst, kannst du dynamische RAG-Anwendungen erstellen: Tools rufen Inhalte zur Laufzeit ab, und Claude zitiert sie in der Antwort. Das folgende Beispiel erzwingt den Tool-Aufruf mit [`tool_choice`](https://platform.claude.com/docs/de/agents-and-tools/tool-use/define-tools#forcing-tool-use), sodass der Abrufschritt jedes Mal ausgeführt wird.

### Beispiel: Wissensdatenbank-Tool

<CodeGroup exclude="shell">
  <CodeGroupItem language="cURL">
    Der Tool-Aufruf-Ablauf benötigt Suchlogik in deiner Anwendung, was mehr als einen einzelnen Shell-Befehl erfordert. Verwende das Anthropic SDK für den vollständigen Ablauf. Für die rohe Anfragestruktur einer Tool-Konversation mit Suchergebnissen siehe [Beide Methoden kombinieren](https://platform.claude.com/docs/de/build-with-claude/search-results#combining-both-methods). Um Suchergebnisse direkt in Benutzernachrichten bereitzustellen, siehe [Methode 2: Suchergebnisse als Inhalt auf oberster Ebene](https://platform.claude.com/docs/de/build-with-claude/search-results#method-2-search-results-as-top-level-content).
  </CodeGroupItem>

  <CodeGroupItem language="CLI">
    Der Tool-Aufruf-Ablauf benötigt Suchlogik in deiner Anwendung, was mehr als einen einzelnen Shell-Befehl erfordert. Verwende das Anthropic SDK für den vollständigen Ablauf. Für die rohe Anfragestruktur einer Tool-Konversation mit Suchergebnissen siehe [Beide Methoden kombinieren](https://platform.claude.com/docs/de/build-with-claude/search-results#combining-both-methods). Um Suchergebnisse direkt in Benutzernachrichten bereitzustellen, siehe [Methode 2: Suchergebnisse als Inhalt auf oberster Ebene](https://platform.claude.com/docs/de/build-with-claude/search-results#method-2-search-results-as-top-level-content).
  </CodeGroupItem>

  ```python Python
  from anthropic.types import (
      MessageParam,
      TextBlockParam,
      SearchResultBlockParam,
      ToolResultBlockParam,
  )

  client = Anthropic()

  # Definiere ein Suchtool für die Wissensdatenbank
  knowledge_base_tool = {
      "name": "search_knowledge_base",
      "description": "Search the company knowledge base for information",
      "input_schema": {
          "type": "object",
          "properties": {"query": {"type": "string", "description": "The search query"}},
          "required": ["query"],
      },
  }


  # Funktion zur Verarbeitung des Tool-Aufrufs
  def search_knowledge_base(query):
      # Deine Suchlogik hier
      # Gibt Suchergebnisse im korrekten Format zurück
      return [
          SearchResultBlockParam(
              type="search_result",
              source="https://docs.company.com/product-guide",
              title="Product Configuration Guide",
              content=[
                  TextBlockParam(
                      type="text",
                      text="To configure the product, navigate to Settings > Configuration. The default timeout is 30 seconds, but can be adjusted between 10-120 seconds based on your needs.",
                  )
              ],
              citations={"enabled": True},
          ),
          SearchResultBlockParam(
              type="search_result",
              source="https://docs.company.com/troubleshooting",
              title="Troubleshooting Guide",
              content=[
                  TextBlockParam(
                      type="text",
                      text="If you encounter timeout errors, first check the configuration settings. Common causes include network latency and incorrect timeout values.",
                  )
              ],
              citations={"enabled": True},
          ),
      ]


  # Baue die Konversation in einer Liste auf, beginnend mit der Frage des Nutzers
  messages: list[MessageParam] = [
      {"role": "user", "content": "How do I configure the timeout settings?"}
  ]

  # Erstelle eine Nachricht mit dem Tool
  response = client.messages.create(
      model="claude-opus-5",
      max_tokens=1024,
      tools=[knowledge_base_tool],
      tool_choice={
          "type": "tool",
          "name": "search_knowledge_base",
          "disable_parallel_tool_use": True,
      },
      messages=messages,
  )

  # Wenn Claude das Tool aufruft, stelle die Suchergebnisse bereit.
  # Der tool_use-Block ist nicht immer der erste: iteriere, um ihn zu finden.
  tool_use = next((block for block in response.content if block.type == "tool_use"), None)
  if tool_use is not None:
      tool_result = search_knowledge_base(tool_use.input["query"])

      # Hänge Claudes Zug und dann das Tool-Ergebnis an die laufende Konversation an
      messages.append({"role": "assistant", "content": response.content})
      messages.append(
          {
              "role": "user",
              "content": [
                  ToolResultBlockParam(
                      type="tool_result",
                      tool_use_id=tool_use.id,
                      content=tool_result,  # Search results go here
                  )
              ],
          }
      )

      # Sende das Tool-Ergebnis zurück
      final_response = client.messages.create(
          model="claude-opus-5",
          max_tokens=1024,
          messages=messages,
      )
      print(final_response)
  ```

  ```typescript TypeScript
  const client = new Anthropic();

  // Definiere ein Tool zur Suche in der Wissensdatenbank
  const knowledgeBaseTool: Anthropic.Tool = {
    name: "search_knowledge_base",
    description: "Search the company knowledge base for information",
    input_schema: {
      type: "object" as const,
      properties: {
        query: {
          type: "string",
          description: "The search query"
        }
      },
      required: ["query"]
    }
  };

  // Funktion zur Verarbeitung des Tool-Aufrufs
  function searchKnowledgeBase(query: string) {
    // Deine Suchlogik hier
    // Gibt Suchergebnisse im korrekten Format zurück
    return [
      {
        type: "search_result" as const,
        source: "https://docs.company.com/product-guide",
        title: "Product Configuration Guide",
        content: [
          {
            type: "text" as const,
            text: "To configure the product, navigate to Settings > Configuration. The default timeout is 30 seconds, but can be adjusted between 10-120 seconds based on your needs."
          }
        ],
        citations: { enabled: true }
      },
      {
        type: "search_result" as const,
        source: "https://docs.company.com/troubleshooting",
        title: "Troubleshooting Guide",
        content: [
          {
            type: "text" as const,
            text: "If you encounter timeout errors, first check the configuration settings. Common causes include network latency and incorrect timeout values."
          }
        ],
        citations: { enabled: true }
      }
    ];
  }

  // Baue die Konversation als Liste auf, beginnend mit der Frage des Nutzers
  const messages: Anthropic.MessageParam[] = [
    { role: "user", content: "How do I configure the timeout settings?" }
  ];

  // Erstelle eine Nachricht mit dem Tool
  const response = await client.messages.create({
    model: "claude-opus-5",
    max_tokens: 1024,
    tools: [knowledgeBaseTool],
    tool_choice: {
      type: "tool",
      name: "search_knowledge_base",
      disable_parallel_tool_use: true
    },
    messages
  });

  // Verarbeite die Tool-Nutzung und liefere Ergebnisse.
  // Der tool_use-Block ist nicht immer der erste: Suche ihn im content-Array.
  const toolUse = response.content.find((block) => block.type === "tool_use");
  if (toolUse) {
    const input = toolUse.input as { query: string };
    const toolResult = searchKnowledgeBase(input.query);

    // Hänge Claudes Zug und dann das Tool-Ergebnis an die laufende Konversation an
    messages.push({ role: "assistant", content: response.content });
    messages.push({
      role: "user",
      content: [
        {
          type: "tool_result" as const,
          tool_use_id: toolUse.id,
          content: toolResult // Search results go here
        }
      ]
    });

    // Sende das Tool-Ergebnis zurück
    const finalResponse = await client.messages.create({
      model: "claude-opus-5",
      max_tokens: 1024,
      messages
    });
    console.log(finalResponse);
  }
  ```

  ```csharp C#
  AnthropicClient client = new();

  var tools = new List<ToolUnion>
  {
      new ToolUnion(new Tool()
      {
          Name = "search_knowledge_base",
          Description = "Search the company knowledge base for information",
          InputSchema = new InputSchema()
          {
              Properties = new Dictionary<string, JsonElement>
              {
                  ["query"] = JsonSerializer.SerializeToElement(new { type = "string", description = "The search query" }),
              },
              Required = ["query"],
          },
      }),
  };

  // Funktion zur Verarbeitung des Tool-Aufrufs
  static List<Block> SearchKnowledgeBase(string query)
  {
      // Deine Suchlogik hier
      // Gibt Suchergebnisse im richtigen Format zurück
      return
      [
          new SearchResultBlockParam
          {
              Source = "https://docs.company.com/product-guide",
              Title = "Product Configuration Guide",
              Content = [new() { Text = "To configure the product, navigate to Settings > Configuration. The default timeout is 30 seconds, but can be adjusted between 10-120 seconds based on your needs." }],
              Citations = new() { Enabled = true },
          },
          new SearchResultBlockParam
          {
              Source = "https://docs.company.com/troubleshooting",
              Title = "Troubleshooting Guide",
              Content = [new() { Text = "If you encounter timeout errors, first check the configuration settings. Common causes include network latency and incorrect timeout values." }],
              Citations = new() { Enabled = true },
          },
      ];
  }

  // Baue die Konversation in einer Liste auf, beginnend mit der Frage des Nutzers
  List<MessageParam> messages = [new UserMessageParam { Content = "How do I configure the timeout settings?" }];

  // Erstelle eine Nachricht mit dem Tool
  var response = await client.Messages.Create(new()
  {
      Model = Model.ClaudeOpus5,
      MaxTokens = 1024,
      Tools = tools,
      ToolChoice = new ToolChoiceTool
      {
          Name = "search_knowledge_base",
          DisableParallelToolUse = true,
      },
      Messages = messages,
  });

  // Wenn Claude das Tool aufruft, stelle die Suchergebnisse bereit.
  // Der tool_use-Block steht nicht immer an erster Stelle: Finde den ersten.
  foreach (var block in response.Content)
  {
      if (block.TryPickToolUse(out var toolUse))
      {
          var query = toolUse.Input["query"].GetString() ?? "";
          var toolResults = SearchKnowledgeBase(query);

          // Hänge Claudes Zug und dann das Tool-Ergebnis an die laufende Konversation an
          messages.Add(new AssistantMessageParam { Content = response.Content.Select(contentBlock => new ContentBlockParam(contentBlock.Json)).ToList() });
          messages.Add(new UserMessageParam
          {
              Content = new MessageContentParam(
                  [new ContentBlockParam(new ToolResultBlockParam() { ToolUseID = toolUse.ID, Content = new ToolResultBlockParamContent(toolResults) })]
              ),
          });

          // Sende das Tool-Ergebnis zurück
          var finalResponse = await client.Messages.Create(new()
          {
              Model = Model.ClaudeOpus5,
              MaxTokens = 1024,
              Messages = messages,
          });
          Console.WriteLine(finalResponse);
          break;
      }
  }
  ```

  ```go Go
  	client := anthropic.NewClient()

  	knowledgeBaseTool := anthropic.ToolUnionParam{
  		OfTool: &anthropic.ToolParam{
  			Name:        "search_knowledge_base",
  			Description: anthropic.String("Search the company knowledge base for information"),
  			InputSchema: anthropic.ToolInputSchemaParam{
  				Properties: map[string]any{
  					"query": map[string]any{
  						"type":        "string",
  						"description": "The search query",
  					},
  				},
  				Required: []string{"query"},
  			},
  		},
  	}

  	// Baue die Konversation in einem Slice auf, beginnend mit der Frage des Nutzers
  	messages := []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("How do I configure the timeout settings?")),
  	}

  	response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  		Model:     anthropic.ModelClaudeOpus5,
  		MaxTokens: 1024,
  		Tools:     []anthropic.ToolUnionParam{knowledgeBaseTool},
  		ToolChoice: anthropic.ToolChoiceUnionParam{
  			OfTool: &anthropic.ToolChoiceToolParam{
  				Name:                   "search_knowledge_base",
  				DisableParallelToolUse: anthropic.Bool(true),
  			},
  		},
  		Messages: messages,
  	})
  	if err != nil {
  		log.Fatal(err)
  	}

  	// Der tool_use-Block ist nicht immer der erste: Suche ihn in der content-Liste
  	var toolUse *anthropic.ToolUseBlock
  	for _, block := range response.Content {
  		if variant, ok := block.AsAny().(anthropic.ToolUseBlock); ok {
  			toolUse = &variant
  			break
  		}
  	}

  	if toolUse != nil {
  		var input struct {
  			Query string `json:"query"`
  		}
  		if err := json.Unmarshal(toolUse.Input, &input); err != nil {
  			log.Fatal(err)
  		}
  		toolResults := searchKnowledgeBase(input.Query)

  		// Hänge Claudes Turn und dann das Tool-Ergebnis an die laufende Konversation an
  		messages = append(messages, response.ToParam())
  		messages = append(messages, anthropic.NewUserMessage(anthropic.ContentBlockParamUnion{
  			OfToolResult: &anthropic.ToolResultBlockParam{
  				ToolUseID: toolUse.ID,
  				Content:   toolResults,
  			},
  		}))

  		// Sende das Tool-Ergebnis zurück
  		finalResponse, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  			Model:     anthropic.ModelClaudeOpus5,
  			MaxTokens: 1024,
  			Messages:  messages,
  		})
  		if err != nil {
  			log.Fatal(err)
  		}
  		fmt.Println(finalResponse)
  	}
  // ...
  func searchKnowledgeBase(query string) []anthropic.ToolResultBlockParamContentUnion {
  	return []anthropic.ToolResultBlockParamContentUnion{
  		{OfSearchResult: &anthropic.SearchResultBlockParam{
  			Content: []anthropic.TextBlockParam{
  				{Text: "To configure the product, navigate to Settings > Configuration. The default timeout is 30 seconds, but can be adjusted between 10-120 seconds based on your needs."},
  			},
  			Source:    "https://docs.company.com/product-guide",
  			Title:     "Product Configuration Guide",
  			Citations: anthropic.CitationsConfigParam{Enabled: anthropic.Bool(true)},
  		}},
  		{OfSearchResult: &anthropic.SearchResultBlockParam{
  			Content: []anthropic.TextBlockParam{
  				{Text: "If you encounter timeout errors, first check the configuration settings. Common causes include network latency and incorrect timeout values."},
  			},
  			Source:    "https://docs.company.com/troubleshooting",
  			Title:     "Troubleshooting Guide",
  			Citations: anthropic.CitationsConfigParam{Enabled: anthropic.Bool(true)},
  		}},
  	}
  }
  ```

  ```java Java
  import com.anthropic.models.messages.ContentBlockParam;
  import com.anthropic.models.messages.CitationsConfigParam;
  // ...
  import com.anthropic.models.messages.MessageParam;
  import com.anthropic.models.messages.Model;
  import com.anthropic.models.messages.SearchResultBlockParam;
  import com.anthropic.models.messages.TextBlockParam;
  import com.anthropic.models.messages.Tool;
  import com.anthropic.models.messages.ToolChoice;
  import com.anthropic.models.messages.ToolChoiceTool;
  import com.anthropic.models.messages.ToolResultBlockParam;
  import com.anthropic.core.JsonValue;
  // ...

  void main() {
      AnthropicClient client = AnthropicOkHttpClient.fromEnv();

      Tool knowledgeBaseTool = Tool.builder()
          .name("search_knowledge_base")
          .description("Search the company knowledge base for information")
          .inputSchema(Tool.InputSchema.builder()
              .properties(JsonValue.from(Map.of(
                  "query", Map.of(
                      "type", "string",
                      "description", "The search query"
                  )
              )))
              .putAdditionalProperty("required", JsonValue.from(List.of("query")))
              .build())
          .build();

      // Baue die Konversation in einer Liste auf, beginnend mit der Frage des Nutzers
      List<MessageParam> messages = new ArrayList<>();
      messages.add(MessageParam.ofUser("How do I configure the timeout settings?"));

      MessageCreateParams params = MessageCreateParams.builder()
          .model(Model.CLAUDE_OPUS_5)
          .maxTokens(1024L)
          .addTool(knowledgeBaseTool)
          .toolChoice(ToolChoice.ofTool(ToolChoiceTool.builder()
              .name("search_knowledge_base")
              .disableParallelToolUse(true)
              .build()))
          .messages(messages)
          .build();

      Message response = client.messages().create(params);

      // Der tool_use-Block steht nicht immer an erster Stelle: Suche ihn in der content-Liste
      response.content().stream()
          .flatMap(contentBlock -> contentBlock.toolUse().stream())
          .findFirst()
          .ifPresent(toolUse -> {
              Map<String, JsonValue> input =
                  (Map<String, JsonValue>) toolUse._input().asObject().get();
              List<ToolResultBlockParam.Content.Block> toolResult = searchKnowledgeBase(
                  input.get("query").asStringOrThrow()
              );

              // Hänge Claudes Turn und dann das Tool-Ergebnis an die laufende Konversation an.
              // Würdest du nur den tool_use-Block neu aufbauen, gingen andere Content-Blöcke verloren, die Claude
              // zurückgegeben hat, z. B. vorangestellter Text, wenn der Tool-Aufruf nicht erzwungen wird.
              messages.add(response.toParam());
              messages.add(MessageParam.ofUserOfContentBlockParams(List.of(
                  ContentBlockParam.ofToolResult(
                      ToolResultBlockParam.builder()
                          .toolUseId(toolUse.id())
                          .contentOfBlocks(toolResult)
                          .build()
                  )
              )));

              // Sende das Tool-Ergebnis zurück
              MessageCreateParams finalParams = MessageCreateParams.builder()
                  .model(Model.CLAUDE_OPUS_5)
                  .maxTokens(1024L)
                  .messages(messages)
                  .build();

              Message finalResponse = client.messages().create(finalParams);
              System.out.println(finalResponse);
          });
  }

  static List<ToolResultBlockParam.Content.Block> searchKnowledgeBase(String query) {
      return List.of(
          ToolResultBlockParam.Content.Block.ofSearchResult(
              SearchResultBlockParam.builder()
                  .source("https://docs.company.com/product-guide")
                  .title("Product Configuration Guide")
                  .content(List.of(
                      TextBlockParam.builder()
                          .text("To configure the product, navigate to Settings > Configuration. The default timeout is 30 seconds, but can be adjusted between 10-120 seconds based on your needs.")
                          .build()
                  ))
                  .citations(CitationsConfigParam.builder()
                      .enabled(true)
                      .build())
                  .build()
          ),
          ToolResultBlockParam.Content.Block.ofSearchResult(
              SearchResultBlockParam.builder()
                  .source("https://docs.company.com/troubleshooting")
                  .title("Troubleshooting Guide")
                  .content(List.of(
                      TextBlockParam.builder()
                          .text("If you encounter timeout errors, first check the configuration settings. Common causes include network latency and incorrect timeout values.")
                          .build()
                  ))
                  .citations(CitationsConfigParam.builder()
                      .enabled(true)
                      .build())
                  .build()
          )
      );
  }
  ```

  ```php PHP
  $client = new Client();

  $knowledgeBaseTool = [
      'name' => 'search_knowledge_base',
      'description' => 'Search the company knowledge base for information',
      'input_schema' => [
          'type' => 'object',
          'properties' => [
              'query' => [
                  'type' => 'string',
                  'description' => 'The search query'
              ]
          ],
          'required' => ['query']
      ]
  ];

  function searchKnowledgeBase($query)
  {
      return [
          [
              'type' => 'search_result',
              'source' => 'https://docs.company.com/product-guide',
              'title' => 'Product Configuration Guide',
              'content' => [
                  [
                      'type' => 'text',
                      'text' => 'To configure the product, navigate to Settings > Configuration. The default timeout is 30 seconds, but can be adjusted between 10-120 seconds based on your needs.'
                  ]
              ],
              'citations' => ['enabled' => true]
          ],
          [
              'type' => 'search_result',
              'source' => 'https://docs.company.com/troubleshooting',
              'title' => 'Troubleshooting Guide',
              'content' => [
                  [
                      'type' => 'text',
                      'text' => 'If you encounter timeout errors, first check the configuration settings. Common causes include network latency and incorrect timeout values.'
                  ]
              ],
              'citations' => ['enabled' => true]
          ]
      ];
  }

  // Baue die Konversation in einer Liste auf, beginnend mit der Frage des Nutzers
  $messages = [
      ['role' => 'user', 'content' => 'How do I configure the timeout settings?']
  ];

  $response = $client->messages->create(
      maxTokens: 1024,
      messages: $messages,
      model: 'claude-opus-5',
      toolChoice: [
          'type' => 'tool',
          'name' => 'search_knowledge_base',
          'disableParallelToolUse' => true,
      ],
      tools: [$knowledgeBaseTool],
  );

  $toolUseBlock = null;
  foreach ($response->content as $block) {
      if ($block->type === 'tool_use') {
          $toolUseBlock = $block;
          break;
      }
  }

  if ($toolUseBlock !== null) {
      $toolResult = searchKnowledgeBase($toolUseBlock->input['query']);

      // Hänge Claudes Antwort und danach das Tool-Ergebnis an die laufende Konversation an
      $messages[] = ['role' => 'assistant', 'content' => $response->content];
      $messages[] = [
          'role' => 'user',
          'content' => [
              [
                  'type' => 'tool_result',
                  'tool_use_id' => $toolUseBlock->id,
                  'content' => $toolResult
              ]
          ]
      ];

      // Sende das Tool-Ergebnis zurück
      $finalResponse = $client->messages->create(
          maxTokens: 1024,
          messages: $messages,
          model: 'claude-opus-5',
      );
      echo $finalResponse;
  } else {
      echo $response;
  }
  ```

  ```ruby Ruby
  client = Anthropic::Client.new

  knowledge_base_tool = {
    name: "search_knowledge_base",
    description: "Search the company knowledge base for information",
    input_schema: {
      type: "object",
      properties: {
        query: { type: "string", description: "The search query" }
      },
      required: ["query"]
    }
  }

  def search_knowledge_base(query)
    [
      {
        type: "search_result",
        source: "https://docs.company.com/product-guide",
        title: "Product Configuration Guide",
        content: [
          {
            type: "text",
            text: "To configure the product, navigate to Settings > Configuration. The default timeout is 30 seconds, but can be adjusted between 10-120 seconds based on your needs."
          }
        ],
        citations: { enabled: true }
      },
      {
        type: "search_result",
        source: "https://docs.company.com/troubleshooting",
        title: "Troubleshooting Guide",
        content: [
          {
            type: "text",
            text: "If you encounter timeout errors, first check the configuration settings. Common causes include network latency and incorrect timeout values."
          }
        ],
        citations: { enabled: true }
      }
    ]
  end

  # Baue die Konversation in einer Liste auf, beginnend mit der Frage des Nutzers
  messages = [
    { role: "user", content: "How do I configure the timeout settings?" }
  ]

  response = client.messages.create(
    model: "claude-opus-5",
    max_tokens: 1024,
    tools: [knowledge_base_tool],
    tool_choice: { type: "tool", name: "search_knowledge_base", disable_parallel_tool_use: true },
    messages: messages
  )

  # Der tool_use-Block ist nicht immer der erste: Suche ihn im content-Array
  tool_use = response.content.find { |block| block.type == :tool_use }

  if tool_use
    tool_result = search_knowledge_base(tool_use.input[:query])

    # Hänge Claudes Zug und dann das Tool-Ergebnis an die laufende Konversation an
    messages << { role: "assistant", content: response.content }
    messages << {
      role: "user",
      content: [
        {
          type: "tool_result",
          tool_use_id: tool_use.id,
          content: tool_result
        }
      ]
    }

    # Sende das Tool-Ergebnis zurück
    final_response = client.messages.create(
      model: "claude-opus-5",
      max_tokens: 1024,
      messages: messages
    )
    puts final_response
  end
  ```
</CodeGroup>

## Methode 2: Suchergebnisse als Inhalt auf oberster Ebene

Du kannst Suchergebnisse auch direkt in Benutzernachrichten bereitstellen. Das ist nützlich für:

* Vorab abgerufene Inhalte aus deiner Suchinfrastruktur
* Zwischengespeicherte Suchergebnisse aus früheren Abfragen
* Inhalte aus externen Suchdiensten
* Tests und Entwicklung

### Beispiel: Direkte Suchergebnisse

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-opus-5-5",
      "max_tokens": 1024,
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "search_result",
              "source": "https://docs.company.com/api-reference",
              "title": "API Reference - Authentication",
              "content": [
                {
                  "type": "text",
                  "text": "All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium."
                }
              ],
              "citations": {
                "enabled": true
              }
            },
            {
              "type": "search_result",
              "source": "https://docs.company.com/quickstart",
              "title": "Getting Started Guide",
              "content": [
                {
                  "type": "text",
                  "text": "To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key."
                }
              ],
              "citations": {
                "enabled": true
              }
            },
            {
              "type": "text",
              "text": "Based on these search results, how do I authenticate API requests and what are the rate limits?"
            }
          ]
        }
      ]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-opus-5-5
  max_tokens: 1024
  messages:
    - role: user
      content:
        - type: search_result
          source: https://docs.company.com/api-reference
          title: API Reference - Authentication
          content:
            - type: text
              text: >-
                All API requests must include an API key in the Authorization
                header. Keys can be generated from the dashboard. Rate limits:
                1000 requests per hour for standard tier, 10000 for premium.
          citations:
            enabled: true
        - type: search_result
          source: https://docs.company.com/quickstart
          title: Getting Started Guide
          content:
            - type: text
              text: >-
                To get started: 1) Sign up for an account, 2) Generate an API
                key from the dashboard, 3) Install our SDK using pip install
                company-sdk, 4) Initialize the client with your API key.
          citations:
            enabled: true
        - type: text
          text: >-
            Based on these search results, how do I authenticate API requests
            and what are the rate limits?
  YAML
  ```

  ```python Python
  from anthropic.types import TextBlockParam, SearchResultBlockParam

  client = Anthropic()

  # Stelle Suchergebnisse direkt in der Nutzernachricht bereit
  response = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      messages=[
          {
              "role": "user",
              "content": [
                  SearchResultBlockParam(
                      type="search_result",
                      source="https://docs.company.com/api-reference",
                      title="API Reference - Authentication",
                      content=[
                          TextBlockParam(
                              type="text",
                              text="All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium.",
                          )
                      ],
                      citations={"enabled": True},
                  ),
                  SearchResultBlockParam(
                      type="search_result",
                      source="https://docs.company.com/quickstart",
                      title="Getting Started Guide",
                      content=[
                          TextBlockParam(
                              type="text",
                              text="To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key.",
                          )
                      ],
                      citations={"enabled": True},
                  ),
                  TextBlockParam(
                      type="text",
                      text="Based on these search results, how do I authenticate API requests and what are the rate limits?",
                  ),
              ],
          }
      ],
  )

  print(response)
  ```

  ```typescript TypeScript
  const client = new Anthropic();

  // Stelle Suchergebnisse direkt in der Benutzernachricht bereit
  const response = await client.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "search_result" as const,
            source: "https://docs.company.com/api-reference",
            title: "API Reference - Authentication",
            content: [
              {
                type: "text" as const,
                text: "All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium."
              }
            ],
            citations: { enabled: true }
          },
          {
            type: "search_result" as const,
            source: "https://docs.company.com/quickstart",
            title: "Getting Started Guide",
            content: [
              {
                type: "text" as const,
                text: "To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key."
              }
            ],
            citations: { enabled: true }
          },
          {
            type: "text" as const,
            text: "Based on these search results, how do I authenticate API requests and what are the rate limits?"
          }
        ]
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  AnthropicClient client = new();

  // Stelle Suchergebnisse direkt in der Nutzernachricht bereit
  var response = await client.Messages.Create(new()
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 1024,
      Messages =
      [
          new UserMessageParam
          {
              Content = new MessageContentParam(
              [
                  new ContentBlockParam(new SearchResultBlockParam
                  {
                      Source = "https://docs.company.com/api-reference",
                      Title = "API Reference - Authentication",
                      Content = [new() { Text = "All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium." }],
                      Citations = new() { Enabled = true },
                  }),
                  new ContentBlockParam(new SearchResultBlockParam
                  {
                      Source = "https://docs.company.com/quickstart",
                      Title = "Getting Started Guide",
                      Content = [new() { Text = "To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key." }],
                      Citations = new() { Enabled = true },
                  }),
                  new ContentBlockParam(new TextBlockParam { Text = "Based on these search results, how do I authenticate API requests and what are the rate limits?" }),
              ]),
          },
      ],
  });

  Console.WriteLine(response);
  ```

  ```go Go
  client := anthropic.NewClient()

  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(
  			anthropic.ContentBlockParamUnion{OfSearchResult: &anthropic.SearchResultBlockParam{
  				Content: []anthropic.TextBlockParam{
  					{Text: "All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium."},
  				},
  				Source:    "https://docs.company.com/api-reference",
  				Title:     "API Reference - Authentication",
  				Citations: anthropic.CitationsConfigParam{Enabled: anthropic.Bool(true)},
  			}},
  			anthropic.ContentBlockParamUnion{OfSearchResult: &anthropic.SearchResultBlockParam{
  				Content: []anthropic.TextBlockParam{
  					{Text: "To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key."},
  				},
  				Source:    "https://docs.company.com/quickstart",
  				Title:     "Getting Started Guide",
  				Citations: anthropic.CitationsConfigParam{Enabled: anthropic.Bool(true)},
  			}},
  			anthropic.NewTextBlock("Based on these search results, how do I authenticate API requests and what are the rate limits?"),
  		),
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Println(response)
  ```

  ```java Java
  import com.anthropic.models.messages.ContentBlockParam;
  import com.anthropic.models.messages.CitationsConfigParam;
  // ...
  import com.anthropic.models.messages.SearchResultBlockParam;
  import com.anthropic.models.messages.TextBlockParam;
  // ...

  void main() {
      AnthropicClient client = AnthropicOkHttpClient.fromEnv();

      MessageCreateParams params = MessageCreateParams.builder()
          .model(Model.CLAUDE_OPUS_5_5)
          .maxTokens(1024L)
          .addUserMessageOfContentBlockParams(List.of(
              ContentBlockParam.ofSearchResult(
                  SearchResultBlockParam.builder()
                      .source("https://docs.company.com/api-reference")
                      .title("API Reference - Authentication")
                      .content(List.of(
                          TextBlockParam.builder()
                              .text("All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium.")
                              .build()
                      ))
                      .citations(CitationsConfigParam.builder()
                          .enabled(true)
                          .build())
                      .build()
              ),
              ContentBlockParam.ofSearchResult(
                  SearchResultBlockParam.builder()
                      .source("https://docs.company.com/quickstart")
                      .title("Getting Started Guide")
                      .content(List.of(
                          TextBlockParam.builder()
                              .text("To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key.")
                              .build()
                      ))
                      .citations(CitationsConfigParam.builder()
                          .enabled(true)
                          .build())
                      .build()
              ),
              ContentBlockParam.ofText(
                  TextBlockParam.builder()
                      .text("Based on these search results, how do I authenticate API requests and what are the rate limits?")
                      .build()
              )
          ))
          .build();

      Message response = client.messages().create(params);
      System.out.println(response);
  }
  ```

  ```php PHP
  $client = new Client();

  $message = $client->messages->create(
      maxTokens: 1024,
      messages: [
          [
              'role' => 'user',
              'content' => [
                  [
                      'type' => 'search_result',
                      'source' => 'https://docs.company.com/api-reference',
                      'title' => 'API Reference - Authentication',
                      'content' => [
                          [
                              'type' => 'text',
                              'text' => 'All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium.'
                          ]
                      ],
                      'citations' => ['enabled' => true]
                  ],
                  [
                      'type' => 'search_result',
                      'source' => 'https://docs.company.com/quickstart',
                      'title' => 'Getting Started Guide',
                      'content' => [
                          [
                              'type' => 'text',
                              'text' => 'To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key.'
                          ]
                      ],
                      'citations' => ['enabled' => true]
                  ],
                  [
                      'type' => 'text',
                      'text' => 'Based on these search results, how do I authenticate API requests and what are the rate limits?'
                  ]
              ]
          ]
      ],
      model: Model::CLAUDE_OPUS_5_5,
  );

  echo json_encode($message, JSON_PRETTY_PRINT);
  ```

  ```ruby Ruby
  client = Anthropic::Client.new

  message = client.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 1024,
    messages: [
      {
        role: "user",
        content: [
          {
            type: "search_result",
            source: "https://docs.company.com/api-reference",
            title: "API Reference - Authentication",
            content: [
              {
                type: "text",
                text: "All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium."
              }
            ],
            citations: { enabled: true }
          },
          {
            type: "search_result",
            source: "https://docs.company.com/quickstart",
            title: "Getting Started Guide",
            content: [
              {
                type: "text",
                text: "To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key."
              }
            ],
            citations: { enabled: true }
          },
          {
            type: "text",
            text: "Based on these search results, how do I authenticate API requests and what are the rate limits?"
          }
        ]
      }
    ]
  )

  puts message
  ```
</CodeGroup>

## Claudes Antwort mit Zitaten

Unabhängig davon, wie Suchergebnisse bereitgestellt werden, fügt Claude automatisch Zitate ein, wenn es Informationen daraus verwendet:

```json
{
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard.",
      "citations": [
        {
          "type": "search_result_location",
          "cited_text": "All API requests must include an API key in the Authorization header. Keys can be generated from the dashboard. Rate limits: 1000 requests per hour for standard tier, 10000 for premium.",
          "source": "https://docs.company.com/api-reference",
          "title": "API Reference - Authentication",
          "search_result_index": 0,
          "start_block_index": 0,
          "end_block_index": 1
        }
      ]
    },
    {
      "type": "text",
      "text": "\n\nTo set this up from scratch, you'll need to "
    },
    {
      "type": "text",
      "text": "sign up for an account, generate an API key from the dashboard, install the SDK using `pip install company-sdk`, and initialize the client with your API key.",
      "citations": [
        {
          "type": "search_result_location",
          "cited_text": "To get started: 1) Sign up for an account, 2) Generate an API key from the dashboard, 3) Install our SDK using pip install company-sdk, 4) Initialize the client with your API key.",
          "source": "https://docs.company.com/quickstart",
          "title": "Getting Started Guide",
          "search_result_index": 1,
          "start_block_index": 0,
          "end_block_index": 1
        }
      ]
    }
  ]
}
```

### Zitatfelder

Jedes Zitat enthält:

| Feld                  | Typ              | Beschreibung                                                                                                                                                                                   |
| --------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`                | string           | Bei Suchergebnis-Zitaten immer `"search_result_location"`                                                                                                                                      |
| `source`              | string           | Die Quelle aus dem ursprünglichen Suchergebnis                                                                                                                                                 |
| `title`               | string oder null | Der Titel aus dem ursprünglichen Suchergebnis                                                                                                                                                  |
| `cited_text`          | string           | Der vollständige Text der zitierten Blöcke, verkettet. Entspricht den zusammengefügten Inhalten von `content[start_block_index:end_block_index]`. Wird nicht auf die Output-Token angerechnet. |
| `search_result_index` | integer          | 0-basierter Index des zitierten Suchergebnisses unter allen `search_result`-Blöcken in der Anfrage, in der Reihenfolge ihres Auftretens (über alle Nachrichten und Tool-Ergebnisse hinweg).    |
| `start_block_index`   | integer          | 0-basierter Index des ersten zitierten Blocks im `content`-Array des Suchergebnisses.                                                                                                          |
| `end_block_index`     | integer          | Exklusiver Endindex des zitierten Blockbereichs im `content`-Array des Suchergebnisses. Immer größer als `start_block_index`.                                                                  |

Die Blockindizes kennzeichnen einen Ausschnitt des `content`-Arrays des Suchergebnisses, und `cited_text` ist der vollständige Text dieses Ausschnitts. Der Textblock ist die kleinste zitierbare Einheit: Claude zitiert ganze Blöcke, keine Teilstrings innerhalb eines Blocks. Um feinere Zitate zu erhalten, teile den Inhalt deiner Suchergebnisse in kleinere Blöcke auf (siehe [Mehrere Inhaltsblöcke](https://platform.claude.com/docs/de/build-with-claude/search-results#multiple-content-blocks)).

## Mehrere Inhaltsblöcke

Suchergebnisse können mehrere Textblöcke im `content`-Array enthalten:

```json
{
  "type": "search_result",
  "source": "https://docs.company.com/api-guide",
  "title": "API Documentation",
  "content": [
    {
      "type": "text",
      "text": "Authentication: All API requests require an API key."
    },
    {
      "type": "text",
      "text": "Rate Limits: The API allows 1000 requests per hour per key."
    },
    {
      "type": "text",
      "text": "Error Handling: The API returns standard HTTP status codes."
    }
  ],
  "citations": { "enabled": true }
}
```

Ein Zitat, das auf den Ratenlimit-Block verweist, sieht so aus:

```json
{
  "type": "search_result_location",
  "cited_text": "Rate Limits: The API allows 1000 requests per hour per key.",
  "source": "https://docs.company.com/api-guide",
  "title": "API Documentation",
  "search_result_index": 0,
  "start_block_index": 1,
  "end_block_index": 2
}
```

Wenn dieses Suchergebnis zitiert wird, geben `start_block_index` und `end_block_index` an, welche dieser Blöcke das Zitat abdeckt, und `cited_text` enthält genau den Text dieser Blöcke. Das Aufteilen von Inhalten in kleinere, fokussierte Blöcke gibt Claude feinere Zitatgrenzen; das Zusammenfassen von Inhalten in einem Block bedeutet, dass jedes Zitat den vollständigen Text zurückgibt. Dies ist dasselbe Modell, das von [benutzerdefinierten Inhaltsdokumenten](https://platform.claude.com/docs/de/build-with-claude/citations#custom-content-documents) in der Citations-Funktion verwendet wird.

## Erweiterte Nutzung

### Beide Methoden kombinieren

Du kannst beide Methoden in derselben Konversation mischen. Claude zitiert aus beiden Quellen, und `search_result_index` zählt alle `search_result`-Blöcke in der Reihenfolge der Anfrage, unabhängig von der Quelle.

Das folgende Beispiel spielt eine vollständige Konversation nach. Die erste Benutzernachricht enthält ein vorab abgerufenes Suchergebnis, der Assistant-Turn ruft ein Wissensdatenbank-Tool auf, und das Tool-Ergebnis gibt ein zweites Suchergebnis zurück. Claudes Antwort zitiert beide Quellen:

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -H "content-type: application/json" \
    -d '{
      "model": "claude-opus-5-5",
      "max_tokens": 1024,
      "tools": [
        {
          "name": "search_knowledge_base",
          "description": "Search the company knowledge base for information",
          "input_schema": {
            "type": "object",
            "properties": {
              "query": {"type": "string", "description": "The search query"}
            },
            "required": ["query"]
          }
        }
      ],
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "type": "search_result",
              "source": "https://docs.company.com/overview",
              "title": "Product Overview",
              "content": [
                {
                  "type": "text",
                  "text": "Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards."
                }
              ],
              "citations": {"enabled": true}
            },
            {
              "type": "text",
              "text": "What does Acme Dashboard do, and what plans is it available on?"
            }
          ]
        },
        {
          "role": "assistant",
          "content": [
            {
              "type": "text",
              "text": "Let me check the pricing information."
            },
            {
              "type": "tool_use",
              "id": "toolu_01A09q90qw90lq917835lq9",
              "name": "search_knowledge_base",
              "input": {"query": "Acme Dashboard pricing plans"}
            }
          ]
        },
        {
          "role": "user",
          "content": [
            {
              "type": "tool_result",
              "tool_use_id": "toolu_01A09q90qw90lq917835lq9",
              "content": [
                {
                  "type": "search_result",
                  "source": "https://docs.company.com/pricing",
                  "title": "Pricing Plans",
                  "content": [
                    {
                      "type": "text",
                      "text": "Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing."
                    }
                  ],
                  "citations": {"enabled": true}
                }
              ]
            }
          ]
        }
      ]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-opus-5-5
  max_tokens: 1024
  tools:
    - name: search_knowledge_base
      description: Search the company knowledge base for information
      input_schema:
        type: object
        properties:
          query:
            type: string
            description: The search query
        required: [query]
  messages:
    - role: user
      content:
        - type: search_result
          source: https://docs.company.com/overview
          title: Product Overview
          content:
            - type: text
              text: >-
                Acme Dashboard is a monitoring tool for distributed systems.
                It supports real-time alerting and custom metric dashboards.
          citations:
            enabled: true
        - type: text
          text: What does Acme Dashboard do, and what plans is it available on?
    - role: assistant
      content:
        - type: text
          text: Let me check the pricing information.
        - type: tool_use
          id: toolu_01A09q90qw90lq917835lq9
          name: search_knowledge_base
          input:
            query: Acme Dashboard pricing plans
    - role: user
      content:
        - type: tool_result
          tool_use_id: toolu_01A09q90qw90lq917835lq9
          content:
            - type: search_result
              source: https://docs.company.com/pricing
              title: Pricing Plans
              content:
                - type: text
                  text: >-
                    Acme Dashboard is available on the Starter plan at $10 per
                    user per month and the Enterprise plan with custom pricing.
              citations:
                enabled: true
  YAML
  ```

  ```python Python
  from anthropic.types import (
      SearchResultBlockParam,
      TextBlockParam,
      ToolResultBlockParam,
      ToolUseBlockParam,
  )

  client = Anthropic()

  knowledge_base_tool = {
      "name": "search_knowledge_base",
      "description": "Search the company knowledge base for information",
      "input_schema": {
          "type": "object",
          "properties": {"query": {"type": "string", "description": "The search query"}},
          "required": ["query"],
      },
  }

  # Spiele eine Unterhaltung ab, die Suchergebnisse auf beide Arten liefert: Die erste
  # Nutzernachricht enthält ein vorab abgerufenes Ergebnis, und das Tool-Ergebnis liefert ein weiteres
  response = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=1024,
      tools=[knowledge_base_tool],
      messages=[
          {
              "role": "user",
              "content": [
                  SearchResultBlockParam(
                      type="search_result",
                      source="https://docs.company.com/overview",
                      title="Product Overview",
                      content=[
                          TextBlockParam(
                              type="text",
                              text="Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards.",
                          )
                      ],
                      citations={"enabled": True},
                  ),
                  TextBlockParam(
                      type="text",
                      text="What does Acme Dashboard do, and what plans is it available on?",
                  ),
              ],
          },
          {
              "role": "assistant",
              "content": [
                  TextBlockParam(
                      type="text", text="Let me check the pricing information."
                  ),
                  ToolUseBlockParam(
                      type="tool_use",
                      id="toolu_01A09q90qw90lq917835lq9",
                      name="search_knowledge_base",
                      input={"query": "Acme Dashboard pricing plans"},
                  ),
              ],
          },
          {
              "role": "user",
              "content": [
                  ToolResultBlockParam(
                      type="tool_result",
                      tool_use_id="toolu_01A09q90qw90lq917835lq9",
                      content=[
                          SearchResultBlockParam(
                              type="search_result",
                              source="https://docs.company.com/pricing",
                              title="Pricing Plans",
                              content=[
                                  TextBlockParam(
                                      type="text",
                                      text="Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing.",
                                  )
                              ],
                              citations={"enabled": True},
                          )
                      ],
                  )
              ],
          },
      ],
  )

  print(response)
  ```

  ```typescript TypeScript
  const client = new Anthropic();

  const knowledgeBaseTool: Anthropic.Tool = {
    name: "search_knowledge_base",
    description: "Search the company knowledge base for information",
    input_schema: {
      type: "object" as const,
      properties: {
        query: { type: "string", description: "The search query" }
      },
      required: ["query"]
    }
  };

  // Spiele eine Konversation ab, die Suchergebnisse auf beide Arten liefert: Die erste
  // Nutzernachricht enthält ein vorab abgerufenes Ergebnis, und das Tool-Ergebnis liefert ein weiteres
  const response = await client.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 1024,
    tools: [knowledgeBaseTool],
    messages: [
      {
        role: "user",
        content: [
          {
            type: "search_result" as const,
            source: "https://docs.company.com/overview",
            title: "Product Overview",
            content: [
              {
                type: "text" as const,
                text: "Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards."
              }
            ],
            citations: { enabled: true }
          },
          {
            type: "text" as const,
            text: "What does Acme Dashboard do, and what plans is it available on?"
          }
        ]
      },
      {
        role: "assistant",
        content: [
          { type: "text" as const, text: "Let me check the pricing information." },
          {
            type: "tool_use" as const,
            id: "toolu_01A09q90qw90lq917835lq9",
            name: "search_knowledge_base",
            input: { query: "Acme Dashboard pricing plans" }
          }
        ]
      },
      {
        role: "user",
        content: [
          {
            type: "tool_result" as const,
            tool_use_id: "toolu_01A09q90qw90lq917835lq9",
            content: [
              {
                type: "search_result" as const,
                source: "https://docs.company.com/pricing",
                title: "Pricing Plans",
                content: [
                  {
                    type: "text" as const,
                    text: "Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing."
                  }
                ],
                citations: { enabled: true }
              }
            ]
          }
        ]
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  AnthropicClient client = new();

  // Spiele eine Konversation ab, die Suchergebnisse auf beide Arten liefert: Die erste
  // Nutzernachricht enthält ein vorab abgerufenes Ergebnis, und das Tool-Ergebnis liefert ein weiteres
  var response = await client.Messages.Create(new()
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 1024,
      Tools =
      [
          new ToolUnion(new Tool()
          {
              Name = "search_knowledge_base",
              Description = "Search the company knowledge base for information",
              InputSchema = new InputSchema()
              {
                  Properties = new Dictionary<string, JsonElement>
                  {
                      ["query"] = JsonSerializer.SerializeToElement(new { type = "string", description = "The search query" }),
                  },
                  Required = ["query"],
              },
          }),
      ],
      Messages =
      [
          new UserMessageParam
          {
              Content = new MessageContentParam(
              [
                  new ContentBlockParam(new SearchResultBlockParam
                  {
                      Source = "https://docs.company.com/overview",
                      Title = "Product Overview",
                      Content = [new() { Text = "Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards." }],
                      Citations = new() { Enabled = true },
                  }),
                  new ContentBlockParam(new TextBlockParam { Text = "What does Acme Dashboard do, and what plans is it available on?" }),
              ]),
          },
          new AssistantMessageParam
          {
              Content = new MessageContentParam(
              [
                  new ContentBlockParam(new TextBlockParam { Text = "Let me check the pricing information." }),
                  new ContentBlockParam(new ToolUseBlockParam
                  {
                      ID = "toolu_01A09q90qw90lq917835lq9",
                      Name = "search_knowledge_base",
                      Input = new Dictionary<string, JsonElement>
                      {
                          ["query"] = JsonSerializer.SerializeToElement("Acme Dashboard pricing plans"),
                      },
                  }),
              ]),
          },
          new UserMessageParam
          {
              Content = new MessageContentParam(
              [
                  new ContentBlockParam(new ToolResultBlockParam()
                  {
                      ToolUseID = "toolu_01A09q90qw90lq917835lq9",
                      Content = new ToolResultBlockParamContent(
                      [
                          new SearchResultBlockParam
                          {
                              Source = "https://docs.company.com/pricing",
                              Title = "Pricing Plans",
                              Content = [new() { Text = "Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing." }],
                              Citations = new() { Enabled = true },
                          },
                      ]),
                  }),
              ]),
          },
      ],
  });

  Console.WriteLine(response);
  ```

  ```go Go
  client := anthropic.NewClient()

  knowledgeBaseTool := anthropic.ToolUnionParam{
  	OfTool: &anthropic.ToolParam{
  		Name:        "search_knowledge_base",
  		Description: anthropic.String("Search the company knowledge base for information"),
  		InputSchema: anthropic.ToolInputSchemaParam{
  			Properties: map[string]any{
  				"query": map[string]any{"type": "string", "description": "The search query"},
  			},
  			Required: []string{"query"},
  		},
  	},
  }

  // Spiele eine Konversation ab, die Suchergebnisse auf beide Arten liefert: Die erste
  // Nutzernachricht enthält ein vorab abgerufenes Ergebnis, und das Tool-Ergebnis liefert ein weiteres
  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 1024,
  	Tools:     []anthropic.ToolUnionParam{knowledgeBaseTool},
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(
  			anthropic.ContentBlockParamUnion{OfSearchResult: &anthropic.SearchResultBlockParam{
  				Content: []anthropic.TextBlockParam{
  					{Text: "Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards."},
  				},
  				Source:    "https://docs.company.com/overview",
  				Title:     "Product Overview",
  				Citations: anthropic.CitationsConfigParam{Enabled: anthropic.Bool(true)},
  			}},
  			anthropic.NewTextBlock("What does Acme Dashboard do, and what plans is it available on?"),
  		),
  		anthropic.NewAssistantMessage(
  			anthropic.NewTextBlock("Let me check the pricing information."),
  			anthropic.ContentBlockParamUnion{OfToolUse: &anthropic.ToolUseBlockParam{
  				ID:    "toolu_01A09q90qw90lq917835lq9",
  				Name:  "search_knowledge_base",
  				Input: map[string]any{"query": "Acme Dashboard pricing plans"},
  			}},
  		),
  		anthropic.NewUserMessage(
  			anthropic.ContentBlockParamUnion{OfToolResult: &anthropic.ToolResultBlockParam{
  				ToolUseID: "toolu_01A09q90qw90lq917835lq9",
  				Content: []anthropic.ToolResultBlockParamContentUnion{
  					{OfSearchResult: &anthropic.SearchResultBlockParam{
  						Content: []anthropic.TextBlockParam{
  							{Text: "Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing."},
  						},
  						Source:    "https://docs.company.com/pricing",
  						Title:     "Pricing Plans",
  						Citations: anthropic.CitationsConfigParam{Enabled: anthropic.Bool(true)},
  					}},
  				},
  			}},
  		),
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Println(response)
  ```

  ```java Java
  import com.anthropic.core.JsonValue;
  import com.anthropic.models.messages.CitationsConfigParam;
  import com.anthropic.models.messages.ContentBlockParam;
  // ...
  import com.anthropic.models.messages.SearchResultBlockParam;
  import com.anthropic.models.messages.TextBlockParam;
  import com.anthropic.models.messages.Tool;
  import com.anthropic.models.messages.ToolResultBlockParam;
  import com.anthropic.models.messages.ToolUseBlockParam;
  // ...

  void main() {
      AnthropicClient client = AnthropicOkHttpClient.fromEnv();

      Tool knowledgeBaseTool = Tool.builder()
          .name("search_knowledge_base")
          .description("Search the company knowledge base for information")
          .inputSchema(Tool.InputSchema.builder()
              .properties(JsonValue.from(Map.of(
                  "query", Map.of("type", "string", "description", "The search query")
              )))
              .putAdditionalProperty("required", JsonValue.from(List.of("query")))
              .build())
          .build();

      // Spiele eine Konversation nach, die Suchergebnisse auf beide Arten liefert: Die erste
      // User-Nachricht enthält ein vorab abgerufenes Ergebnis, und das Tool-Ergebnis liefert ein weiteres
      MessageCreateParams params = MessageCreateParams.builder()
          .model(Model.CLAUDE_OPUS_5_5)
          .maxTokens(1024L)
          .addTool(knowledgeBaseTool)
          .addUserMessageOfContentBlockParams(List.of(
              ContentBlockParam.ofSearchResult(SearchResultBlockParam.builder()
                  .source("https://docs.company.com/overview")
                  .title("Product Overview")
                  .content(List.of(TextBlockParam.builder()
                      .text("Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards.")
                      .build()))
                  .citations(CitationsConfigParam.builder()
                      .enabled(true)
                      .build())
                  .build()),
              ContentBlockParam.ofText(TextBlockParam.builder()
                  .text("What does Acme Dashboard do, and what plans is it available on?")
                  .build())
          ))
          .addAssistantMessageOfContentBlockParams(List.of(
              ContentBlockParam.ofText(TextBlockParam.builder()
                  .text("Let me check the pricing information.")
                  .build()),
              ContentBlockParam.ofToolUse(ToolUseBlockParam.builder()
                  .id("toolu_01A09q90qw90lq917835lq9")
                  .name("search_knowledge_base")
                  .input(JsonValue.from(Map.of("query", "Acme Dashboard pricing plans")))
                  .build())
          ))
          .addUserMessageOfContentBlockParams(List.of(
              ContentBlockParam.ofToolResult(ToolResultBlockParam.builder()
                  .toolUseId("toolu_01A09q90qw90lq917835lq9")
                  .contentOfBlocks(List.of(
                      ToolResultBlockParam.Content.Block.ofSearchResult(SearchResultBlockParam.builder()
                          .source("https://docs.company.com/pricing")
                          .title("Pricing Plans")
                          .content(List.of(TextBlockParam.builder()
                              .text("Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing.")
                              .build()))
                          .citations(CitationsConfigParam.builder()
                              .enabled(true)
                              .build())
                          .build())
                  ))
                  .build())
          ))
          .build();

      Message response = client.messages().create(params);
      System.out.println(response);
  }
  ```

  ```php PHP
  $client = new Client();

  $knowledgeBaseTool = [
      'name' => 'search_knowledge_base',
      'description' => 'Search the company knowledge base for information',
      'input_schema' => [
          'type' => 'object',
          'properties' => [
              'query' => ['type' => 'string', 'description' => 'The search query']
          ],
          'required' => ['query']
      ]
  ];

  // Spiele eine Unterhaltung ab, die Suchergebnisse auf beide Arten liefert: Die erste
  // Nutzernachricht enthält ein vorab abgerufenes Ergebnis, und das Tool-Ergebnis liefert ein weiteres
  $response = $client->messages->create(
      maxTokens: 1024,
      tools: [$knowledgeBaseTool],
      messages: [
          [
              'role' => 'user',
              'content' => [
                  [
                      'type' => 'search_result',
                      'source' => 'https://docs.company.com/overview',
                      'title' => 'Product Overview',
                      'content' => [
                          [
                              'type' => 'text',
                              'text' => 'Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards.'
                          ]
                      ],
                      'citations' => ['enabled' => true]
                  ],
                  [
                      'type' => 'text',
                      'text' => 'What does Acme Dashboard do, and what plans is it available on?'
                  ]
              ]
          ],
          [
              'role' => 'assistant',
              'content' => [
                  ['type' => 'text', 'text' => 'Let me check the pricing information.'],
                  [
                      'type' => 'tool_use',
                      'id' => 'toolu_01A09q90qw90lq917835lq9',
                      'name' => 'search_knowledge_base',
                      'input' => ['query' => 'Acme Dashboard pricing plans']
                  ]
              ]
          ],
          [
              'role' => 'user',
              'content' => [
                  [
                      'type' => 'tool_result',
                      'tool_use_id' => 'toolu_01A09q90qw90lq917835lq9',
                      'content' => [
                          [
                              'type' => 'search_result',
                              'source' => 'https://docs.company.com/pricing',
                              'title' => 'Pricing Plans',
                              'content' => [
                                  [
                                      'type' => 'text',
                                      'text' => 'Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing.'
                                  ]
                              ],
                              'citations' => ['enabled' => true]
                          ]
                      ]
                  ]
              ]
          ]
      ],
      model: Model::CLAUDE_OPUS_5_5,
  );

  echo json_encode($response, JSON_PRETTY_PRINT);
  ```

  ```ruby Ruby
  client = Anthropic::Client.new

  knowledge_base_tool = {
    name: "search_knowledge_base",
    description: "Search the company knowledge base for information",
    input_schema: {
      type: "object",
      properties: {
        query: { type: "string", description: "The search query" }
      },
      required: ["query"]
    }
  }

  # Spiele eine Konversation ab, die Suchergebnisse auf beide Arten liefert: Die erste
  # Nutzernachricht enthält ein vorab abgerufenes Ergebnis, und das Tool-Ergebnis liefert ein weiteres
  response = client.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 1024,
    tools: [knowledge_base_tool],
    messages: [
      {
        role: "user",
        content: [
          {
            type: "search_result",
            source: "https://docs.company.com/overview",
            title: "Product Overview",
            content: [
              {
                type: "text",
                text: "Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards."
              }
            ],
            citations: { enabled: true }
          },
          {
            type: "text",
            text: "What does Acme Dashboard do, and what plans is it available on?"
          }
        ]
      },
      {
        role: "assistant",
        content: [
          { type: "text", text: "Let me check the pricing information." },
          {
            type: "tool_use",
            id: "toolu_01A09q90qw90lq917835lq9",
            name: "search_knowledge_base",
            input: { query: "Acme Dashboard pricing plans" }
          }
        ]
      },
      {
        role: "user",
        content: [
          {
            type: "tool_result",
            tool_use_id: "toolu_01A09q90qw90lq917835lq9",
            content: [
              {
                type: "search_result",
                source: "https://docs.company.com/pricing",
                title: "Pricing Plans",
                content: [
                  {
                    type: "text",
                    text: "Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing."
                  }
                ],
                citations: { enabled: true }
              }
            ]
          }
        ]
      }
    ]
  )

  puts response
  ```
</CodeGroup>

Die Antwort zitiert beide Quellen. Das vorab abgerufene Ergebnis ist `search_result_index: 0` und das vom Tool zurückgegebene Ergebnis ist `search_result_index: 1`, entsprechend der Reihenfolge, in der die `search_result`-Blöcke in der Konversation erscheinen:

```json
{
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "Here's what I found about Acme Dashboard:\n\n**What it does:** "
    },
    {
      "type": "text",
      "text": "Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards.",
      "citations": [
        {
          "type": "search_result_location",
          "cited_text": "Acme Dashboard is a monitoring tool for distributed systems. It supports real-time alerting and custom metric dashboards.",
          "source": "https://docs.company.com/overview",
          "title": "Product Overview",
          "search_result_index": 0,
          "start_block_index": 0,
          "end_block_index": 1
        }
      ]
    },
    {
      "type": "text",
      "text": "\n\n**Available plans:** "
    },
    {
      "type": "text",
      "text": "Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing.",
      "citations": [
        {
          "type": "search_result_location",
          "cited_text": "Acme Dashboard is available on the Starter plan at $10 per user per month and the Enterprise plan with custom pricing.",
          "source": "https://docs.company.com/pricing",
          "title": "Pricing Plans",
          "search_result_index": 1,
          "start_block_index": 0,
          "end_block_index": 1
        }
      ]
    }
  ]
}
```

### Mischen mit anderen Inhaltstypen

In Benutzernachrichten können `search_result`-Blöcke neben jedem anderen Inhaltsblock stehen. Das Beispiel zu Methode 2 kombiniert Suchergebnisse mit einer `text`-Frage, und Bild- oder Dokumentblöcke können auf dieselbe Weise hinzukommen.

Tool-Ergebnisse sind strenger: Wenn ein Block in einem `tool_result`-Content-Array ein `search_result` ist, müssen alle seine Blöcke `search_result` sein. Das Mischen von Suchergebnissen mit anderen Blocktypen im selben Tool-Ergebnis führt zu einem Validierungsfehler. Um ergänzenden Text zusammen mit aus Tools stammenden Suchergebnissen zurückzugeben, füge ihn als Textblock in das `content`-Array eines der Suchergebnisse ein, wo er ebenfalls zitierbar wird.

### Cache-Steuerung

Füge `cache_control` zum Suchergebnisblock hinzu, um ihn für die Wiederverwendung über Anfragen hinweg zwischenzuspeichern. Es steht neben `citations` im selben Block:

```json
{
  "type": "search_result",
  "source": "https://docs.company.com/guide",
  "title": "User Guide",
  "content": [{ "type": "text", "text": "..." }],
  "citations": { "enabled": true },
  "cache_control": { "type": "ephemeral" }
}
```

Siehe [Prompt-Caching](https://platform.claude.com/docs/de/build-with-claude/prompt-caching) für Mindestlängen zum Caching und weitere Anforderungen.

### Zitatsteuerung

Standardmäßig sind Zitate für Suchergebnisse deaktiviert. Du kannst Zitate aktivieren, indem du die `citations`-Konfiguration explizit festlegst:

```json
{
  "type": "search_result",
  "source": "https://docs.company.com/guide",
  "title": "User Guide",
  "content": [{ "type": "text", "text": "Important documentation..." }],
  "citations": {
    "enabled": true // Enable citations for this result
  }
}
```

Wenn `citations.enabled` auf `true` gesetzt ist, hängt Claude Zitatverweise an die Textblöcke an, die sich auf das Suchergebnis stützen.

<Warning>
  Zitate gelten nach dem Alles-oder-nichts-Prinzip: Entweder müssen bei allen Suchergebnissen in einer Anfrage Zitate aktiviert sein, oder bei allen müssen sie deaktiviert sein. Das Mischen von Suchergebnissen mit unterschiedlichen Zitateinstellungen führt zu einem Fehler.
</Warning>

## Best Practices

### Für toolbasierte Suche (Methode 1)

* **Dynamische Inhalte:** Verwende sie für Echtzeitsuchen und dynamische RAG-Anwendungen
* **Fehlerbehandlung:** Gib passende Meldungen zurück, wenn Suchen fehlschlagen
* **Ergebnislimits:** Gib nur die relevantesten Ergebnisse zurück, um einen Kontextüberlauf zu vermeiden

### Für Suche auf oberster Ebene (Methode 2)

* **Vorab abgerufene Inhalte:** Verwende sie, wenn du bereits Suchergebnisse hast
* **Stapelverarbeitung:** Verwende sie, um mehrere Suchergebnisse auf einmal zu verarbeiten
* **Tests:** Verwende sie, um das Zitatverhalten mit bekannten Inhalten zu testen

### Allgemeine Best Practices

1. **Ergebnisse effektiv strukturieren:**

   * Verwende klare, dauerhafte Quell-URLs
   * Gib aussagekräftige Titel an
   * Teile lange Inhalte in logische Textblöcke auf, um Claude feinere Zitatgrenzen zu geben

2. **Konsistenz wahren:**

   * Verwende in deiner gesamten Anwendung einheitliche Quellformate
   * Stelle sicher, dass Titel den Inhalt genau widerspiegeln
   * Halte die Formatierung einheitlich

3. **Fehler elegant behandeln:** Wenn eine Suche fehlschlägt oder nichts zurückgibt, gib einen einfachen Textblock zurück, der das Ergebnis beschreibt (zum Beispiel `{"type": "text", "text": "No results found."}`), anstatt einen Fehler auszulösen: Claude erklärt dem Benutzer das leere Ergebnis, und die Konversation wird fortgesetzt.

## Einschränkungen

* Innerhalb von Suchergebnissen werden nur Textinhalte unterstützt (keine Bilder oder anderen Medien).
* `search_result`-Blöcke können nur in Benutzernachrichten erscheinen (einschließlich innerhalb von Tool-Ergebnissen). Assistant-Nachrichten mit Suchergebnissen werden abgelehnt.
* Wenn das [Websuche-Tool](https://platform.claude.com/docs/de/agents-and-tools/tool-use/web-search-tool) in derselben Anfrage aktiviert ist, müssen Zitate für alle `search_result`-Blöcke aktiviert sein.

## Nächste Schritte

<CardGroup cols={2}>
  <Card title="Streaming-Ablehnungen" icon="lock" href="https://platform.claude.com/docs/de/test-and-evaluate/strengthen-guardrails/handle-streaming-refusals">
    Erkenne und behandle Ablehnungs-Stop-Reasons in Streaming-Antworten und wiederhole abgelehnte Anfragen mit einem Fallback-Modell.
  </Card>

  <Card title="Zitate" icon="book" href="https://platform.claude.com/docs/de/build-with-claude/citations">
    Verankere Claudes Antworten in deinen Quelldokumenten. Zitate geben die genauen Passagen zurück, die jede Aussage stützen, sodass du Antworten überprüfen und deinen Benutzern Quellen anzeigen kannst.
  </Card>

  <Card title="Websuche-Tool" icon="magnifying-glass" href="https://platform.claude.com/docs/de/agents-and-tools/tool-use/web-search-tool">
    Gib Claude Zugriff auf aktuelle Webinhalte mit zitierten Quellen, optionaler dynamischer Filterung und Domain-Steuerung.
  </Card>

  <Card title="Messages-API-Referenz" icon="code" href="https://platform.claude.com/docs/de/api/messages/create">
    Sieh dir die vollständige Dokumentation der Messages API an, einschließlich der Inhaltsblocktypen.
  </Card>

  <Card title="Prompt-Caching" icon="database" href="https://platform.claude.com/docs/de/build-with-claude/prompt-caching">
    Speichere Suchergebnisse mit `cache_control` zwischen, um Kosten und Latenz bei wiederholten Anfragen zu reduzieren.
  </Card>
</CardGroup>

## Verfügbarkeit

Suchergebnisse sind auf allen Modellen verfügbar und für Zero Data Retention und HIPAA-Bereitschaft berechtigt.

### API-Unterstützung

#### [Messages API](https://platform.claude.com/docs/de/build-with-claude/working-with-messages)

* Verfügbarkeit: Verfügbar
* Nutzung: Sende `search_result`-Blöcke in einem Tool-Ergebnis oder direkt in einer Benutzernachricht.

| Status    | Cloud-Plattformen              |
| --------- | ------------------------------ |
| Verfügbar | Alle unterstützten Plattformen |

#### [Managed Agents](https://platform.claude.com/docs/de/managed-agents/overview)

* Verfügbarkeit: Verfügbar
* Nutzung: Nur in Tool-Ergebnissen akzeptiert, etwa in einem Event `user.custom_tool_result`, nicht in Events `user.message`.

| Status    | Cloud-Plattformen              |
| --------- | ------------------------------ |
| Verfügbar | Alle unterstützten Plattformen |

### Datenverarbeitung

[Übersicht über die Datenverarbeitung](https://platform.claude.com/docs/de/manage-claude/api-and-data-retention#feature-eligibility)

| Element | Zero Data Retention                                                                                                                                                 | HIPAA      |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| Status  | Berechtigt (ausgenommen: [Abgedeckte Modelle](https://platform.claude.com/docs/de/manage-claude/api-and-data-retention#model-specific-data-retention-requirements)) | Berechtigt |

Zutreffende Endpunkte:

* `/v1/messages` mit Quelle `search_results`
