Method: projects.locations.collections.dataConnector.invokeConnectorMcp

呼叫 MCP 連接器。

HTTP 要求


POST https://discoveryengine.googleapis.com/v1alpha/{name=projects/*/locations/*/collections/*/dataConnector}:invokeConnectorMcp

這些網址使用 gRPC 轉碼語法。

路徑參數

參數
name

string

這是必要旗標,DataConnector 資源。

用於發出 MCP 呼叫的資料連接器。

要求主體

要求主體包含下列結構的資料:

JSON 表示法
{
  "method": string,
  "params": {
    object
  },
  "engine": string,
  "toolSpecVersion": string
}
欄位
method

string

這是必要旗標,要叫用的方法 (例如「tools/list」、「tools/call」、「resources/read」、「prompts/get」等)。

params

object (Struct format)

選用。方法的任意結構化參數。

使用 google.protobuf.Struct 可讓酬載結構定義保持彈性,與 JSON-RPC 的任意形式 params 欄位相符。

engine

string

選用。引擎資源名稱 (例如「projects/{project}/locations/{location}/collections/{collection}/engines/{engine}」)。在叫用發出 Discovery Search Service 要求的工具登錄工具時,做為搜尋引擎 ID。

toolSpecVersion

string

選用。用來解析連結器工具介面的工具規格版本。這對應於連接器的 BAP 工具規格檔案名稱 (例如「v2」、「v5.2」)。如果不設定這項政策,伺服器會使用連接器的預設 (最新) 工具規格。適用於所有方法 (例如「tools/list」和「tools/call」)。

回應主體

回應訊息,傳回 MCP 連接器叫用結果。其中包含成功結果的酬載或錯誤詳細資料。

如果成功,回應主體會含有以下結構的資料:

JSON 表示法
{

  // The following is a list of mutually exclusive fields. At most one of the
  // fields will be set in a response:
  "result": value,
  "error": {
    object (McpError)
  }
  // End of mutually exclusive fields.
}
欄位
應設定 result 或 error 其中之一。以下列出互斥欄位。回應中最多會設定一個欄位:
result

value (Value format)

成功結果 - 任意結構化資料。

error

object (McpError)

呼叫失敗時的錯誤詳細資料。

互斥欄位的結尾。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/discoveryengine.assist.readwrite
  • https://www.googleapis.com/auth/discoveryengine.readwrite
  • https://www.googleapis.com/auth/discoveryengine.serving.readwrite

詳情請參閱Authentication Overview。

IAM 權限

需要 name 資源的下列 IAM 權限:

  • discoveryengine.dataConnectors.executeAction

詳情請參閱 IAM 說明文件。

McpError

如果 MCP 呼叫失敗,McpError 會代表錯誤詳細資料。這個結構遵循 JSON-RPC 2.0 錯誤物件形狀。

JSON 表示法
{
  "code": integer,
  "message": string,
  "data": value
}
欄位
code

integer

數字錯誤代碼。

message

string

使用者容易理解的錯誤簡短說明。

data

value (Value format)

選用結構化資料,內含其他錯誤背景資訊。