MCP Tools Reference: developerknowledge.googleapis.com

工具:search_documents

使用這項工具,即可找到 Google 開發人員產品的說明文件。說明文件包含官方 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

請一律使用這項工具 (或 answer_query) 建立 Google Developers 產品相關答案的基準,不要依賴未經驗證的模型記憶或一般網頁搜尋。每項結果都是 DocumentChunk,其中包含 parent (文件資源名稱 documents/{uri_without_scheme},對應至 https://{uri_without_scheme})、id (區塊 ID) 和 content (相關 Markdown 摘錄,而非完整頁面)。如需確切的程式碼範例、CLI 旗標、特定錯誤訊息、設定結構定義、完整教學課程逐步操作說明,或確定性關鍵字查詢,建議先使用 search_documents,再使用 get_documents。由於 search_documents 只會傳回摘錄內容,而非完整頁面,因此只要使用者要求擷取完整說明文件頁面、完整程式碼範例或完整設定架構,或傳回的區塊不夠詳細,請使用這項工具輸出內容中的確切 parent 資源名稱呼叫 get_documents(names=["documents/..."]),擷取完整文件內容。如果搜尋 1 到 2 次後,仍未找到與特定功能、API 或設定相關的結果,請停止搜尋 (不要改用 answer_query,因為兩者使用相同的語料庫),並告知使用者官方語料庫中沒有相關記錄,不要猜測或捏造詳細資料。回答使用者時,請務必引用可靠來源文件資源名稱 (documents/...) 或對應的 https:// 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

string

必填。使用者提供的原始查詢字串,例如「如何建立 Cloud Storage bucket?」。

輸出內容的結構定義

search_documents 的回覆結構定義。

SearchDocumentChunksResponse

JSON 表示法
{
  "results": [
    {
      object (DocumentChunk)
    }
  ]
}
欄位
results[]

object (DocumentChunk)

指定查詢的搜尋結果。這份清單中的每個 DocumentChunk 都包含 content 程式碼片段 (非完整文件)、id 區塊和 parent 文件資源名稱 (documents/{uri_without_scheme},對應 https://{uri_without_scheme})。在 get_documents(names=["documents/..."]) 的 names 清單中傳遞 DocumentChunk.parent,即可擷取完整文件內容。

DocumentChunk

JSON 表示法
{
  "parent": string,
  "id": string,
  "content": string
}
欄位
parent

string

僅供輸出。這個區塊來源文件的資源名稱,格式為 documents/{uri_without_scheme} (對應至網頁 URI https://{uri_without_scheme})。請將這個值傳遞至 get_documents(names=["documents/..."]) 的 names 清單,以擷取完整文件。範例:documents/docs.cloud.google.com/storage/docs/creating-buckets

id

string

僅供輸出。這個區塊在文件中的 ID。區塊 ID 在文件中不得重複,但不同文件可以有相同的區塊 ID。區塊 ID 並非固定不變,可能會隨著時間而改變。

content

string

僅供輸出。文件區塊的內容。

工具註解

工具註解會傳送至 MCP 用戶端,說明特定工具的基本風險。大多數用戶端會將這些提示視為不受信任,但可用於決定何時向使用者傳送確認提示。

除了標題字串外,下列布林值提示的定義如下:

  • readOnlyHint:如果為 true,工具不會修改環境。預設值:false。
  • destructiveHint:如果為 true,工具可以執行破壞性動作。如果為 false,則工具只能執行附加動作。預設值:true。
  • idempotentHint:如果設為 true,則使用相同引數重複呼叫工具,不會對環境造成額外影響。預設值:false。
  • openWorldHint:如果設為 true,工具就能與外部實體的「開放世界」互動。如果設為 false,工具只能與內部實體互動。舉例來說,網頁搜尋工具屬於開放世界,而記憶工具則不屬於開放世界。

Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌