工具:search_documentation
從官方的 Google Pay 和 Google 錢包開發人員說明文件和程式碼範例中搜尋並檢索最相關、最新的章節。
下列程式碼範例說明如何使用 curl 呼叫 search_documentation MCP 工具。
| Curl 要求 |
|---|
curl --location 'https://paydeveloper.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "search_documentation", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
輸入內容的結構定義
用於搜尋說明文件的要求訊息。
SearchDocumentationRequest
| JSON 表示法 |
|---|
{ "userQuery": string, "languageCode": string } |
| 欄位 | |
|---|---|
userQuery |
必填。要搜尋的查詢。 |
languageCode |
(選用步驟) 搜尋查詢的 IETF BCP-47 語言代碼。 |
輸出內容的結構定義
搜尋文件的回應訊息。
SearchDocumentationResponse
| JSON 表示法 |
|---|
{
"results": [
{
object ( |
| 欄位 | |
|---|---|
results[] |
符合搜尋查詢的文件分塊,並根據相關性分數排序,該分數會評估使用者查詢與分塊內容的相似度。 |
DocumentChunk
| JSON 表示法 |
|---|
{ "title": string, "uri": string, "content": string } |
| 欄位 | |
|---|---|
title |
指定區塊所屬文件的標題。 |
uri |
指定區塊所屬文件的 URI。 |
content |
包含資料塊的內容。 |
工具註解
工具註解會傳送至 MCP 用戶端,說明特定工具的基本風險。大多數用戶端會將這些提示視為不受信任,但可用於決定何時向使用者傳送確認提示。
除了標題字串外,以下布林提示的定義如下:
readOnlyHint:如果為 true,工具不會修改環境。預設值:false。destructiveHint:如果為 true,工具可以執行破壞性動作。如果為 false,工具只能執行加法動作。預設值:true。idempotentHint:如果為 true,以相同引數重複呼叫工具,對環境不會有額外影響。預設值:false。openWorldHint:設為 true 時,工具可以與外部實體的「開放世界」互動。如果為 false,工具只能與內部實體互動。舉例來說,網頁搜尋工具屬於開放世界,記憶體工具則不屬於開放世界。
破壞性提示:❌ | 等冪提示:✅ | 唯讀提示:✅ | 開放世界提示:❌