工具:search_documents
這項工具可用來尋找 Google Developers 產品的說明文件。這些文件包含官方 API、程式碼片段、版本資訊、最佳做法、指南、偵錯資訊等。涵蓋下列產品和網域:
ADK:adk.dev
Android:developer.android.com
Apigee:docs.apigee.com
Chrome:developer.chrome.com
Dart:dart.dev
Firebase:firebase.google.com
Flutter:docs.flutter.dev
Fuchsia:fuchsia.dev
Gemini CLI:geminicli.com
Genkit:genkit.dev
Go:go.dev
Google AI:ai.google.dev
Google Antigravity:antigravity.google
Google Cloud:cloud.google.com 和 docs.cloud.google.com
Google Developers、Google Ads、Google 搜尋、Google 地圖、YouTube:developers.google.com
Google Home:developers.home.google.com
Google Maps Platform:mapsplatform.google.com
Google Workspace:knowledge.workspace.google.com
TensorFlow:www.tensorflow.org
網頁:web.dev
這項工具會傳回相符文件的文字、名稱和 URI 區塊。如需確切的程式碼範例、CLI 旗標、特定錯誤訊息、完整教學課程逐步操作說明,或確定性關鍵字查詢,建議先使用 search_documents,再使用 get_documents。如果傳回的區塊不夠詳細,無法回答使用者的問題,請使用 get_documents,並搭配這項工具輸出內容中的 parent,擷取完整文件內容。回覆使用者時,請務必引用可靠來源文件資源名稱 (documents/...) 或 URI。
以下程式碼範例說明如何使用 curl 呼叫 search_documents MCP 工具。
| Curl 要求 |
|---|
curl --location 'https://developerknowledge.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "search_documents", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
輸入內容的結構定義
search_documents 的要求結構定義。使用 query 欄位搜尋相關的 Google 開發人員說明文件。
SearchDocumentChunksRequest
| JSON 表示法 |
|---|
{ "query": string } |
| 欄位 | |
|---|---|
query |
必填。使用者提供的原始查詢字串,例如「如何建立 Cloud Storage bucket?」。 |
輸出內容的結構定義
search_documents 的回覆結構定義。
SearchDocumentChunksResponse
| JSON 表示法 |
|---|
{
"results": [
{
object ( |
| 欄位 | |
|---|---|
results[] |
指定查詢的搜尋結果。這份清單中的每個 DocumentChunk 都包含與搜尋查詢相關的內容片段。將每個結果的 |
DocumentChunk
| JSON 表示法 |
|---|
{ "parent": string, "id": string, "content": string } |
| 欄位 | |
|---|---|
parent |
僅供輸出。這個區塊所屬文件的資源名稱,格式: |
id |
僅供輸出。這項資訊在文件中的 ID。區塊 ID 在文件中不得重複,但不同文件可以有相同的區塊 ID。區塊 ID 並非固定不變,可能會隨著時間而改變。 |
content |
僅供輸出。文件區塊的內容。 |
工具註解
工具註解會傳送至 MCP 用戶端,說明特定工具的基本風險。大多數用戶端會將這些提示視為不受信任,但可用於決定何時向使用者傳送確認提示。
除了標題字串外,下列布林值提示的定義如下:
readOnlyHint:如果為 true,工具不會修改環境。預設值:false。destructiveHint:如果為 true,工具可以執行破壞性動作。如果設為 false,工具只能執行新增動作。預設值:true。idempotentHint:如果設為 true,則使用相同引數重複呼叫工具,不會對環境產生額外影響。預設值:false。openWorldHint:如果設為 true,工具就能與外部實體的「開放世界」互動。如果設為 false,工具只能與內部實體互動。舉例來說,網頁搜尋工具屬於開放世界,而記憶工具則不屬於開放世界。
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌