MCP Tools Reference: developerconnect.googleapis.com

工具:create-connection

在指定專案和位置建立新連線。

下列程式碼範例說明如何使用 curl 呼叫 create-connection MCP 工具。

Curl 要求
curl --location 'https://developerconnect.googleapis.com/mcp' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/event-stream' \
--data '{
  "method": "tools/call",
  "params": {
    "name": "create-connection",
    "arguments": {
      // Provide these details according to the MCP tool specification.
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'

輸入內容的結構定義

建立連線的訊息

CreateConnectionRequest

JSON 表示法
{
  "parent": string,
  "connectionId": string,
  "connection": {
    object (Connection)
  },
  "requestId": string,
  "validateOnly": boolean
}
欄位
parent

string

這是必要旗標,上層的值。

connectionId

string

這是必要旗標,連線使用的 ID,會成為連線資源名稱的最後一個部分。

connection

object (Connection)

這是必要旗標,正在建立的資源

requestId

string

選用。選用的要求 ID,用於識別要求。請指定專屬要求 ID,這樣一來,如果您必須重試要求,伺服器就會知道要忽略已完成的要求。伺服器會保證從第一次要求起至少 60 分鐘內有效。

舉例來說,假設您提出初始要求,但要求逾時。如果您使用相同的要求 ID 再次提出要求,伺服器會檢查是否已收到具有相同要求 ID 的原始作業,如果是,則會忽略第二個要求。避免用戶端不小心建立重複的承諾使用合約。

要求 ID 必須是有效的 UUID,但不得為零 UUID (00000000-0000-0000-0000-000000000000)。

validateOnly

boolean

選用。如果設定,則驗證要求,但不要實際發布。

連線

JSON 表示法
{
  "name": string,
  "createTime": string,
  "updateTime": string,
  "deleteTime": string,
  "labels": {
    string: string,
    ...
  },
  "installationState": {
    object (InstallationState)
  },
  "disabled": boolean,
  "reconciling": boolean,
  "annotations": {
    string: string,
    ...
  },
  "etag": string,
  "uid": string,
  "cryptoKeyConfig": {
    object (CryptoKeyConfig)
  },
  "gitProxyConfig": {
    object (GitProxyConfig)
  },

  // Union field connection_config can be only one of the following:
  "githubConfig": {
    object (GitHubConfig)
  },
  "githubEnterpriseConfig": {
    object (GitHubEnterpriseConfig)
  },
  "gitlabConfig": {
    object (GitLabConfig)
  },
  "gitlabEnterpriseConfig": {
    object (GitLabEnterpriseConfig)
  },
  "bitbucketDataCenterConfig": {
    object (BitbucketDataCenterConfig)
  },
  "bitbucketCloudConfig": {
    object (BitbucketCloudConfig)
  },
  "secureSourceManagerInstanceConfig": {
    object (SecureSourceManagerInstanceConfig)
  },
  "httpConfig": {
    object (GenericHTTPEndpointConfig)
  }
  // End of list of possible types for union field connection_config.
}
欄位
name

string

ID。連線的資源名稱,格式為 projects/{project}/locations/{location}/connections/{connection_id}。

createTime

string (Timestamp format)

僅供輸出。建立時間戳記。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z"、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30"。

updateTime

string (Timestamp format)

僅供輸出。更新時間戳記。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z"、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30"。

deleteTime

string (Timestamp format)

僅供輸出。刪除時間戳記。

使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例:"2014-10-02T15:01:23Z"、"2014-10-02T15:01:23.045123456Z" 或 "2014-10-02T15:01:23+05:30"。

labels

map (key: string, value: string)

選用。標籤 (鍵/值組合)

包含 "key": value 組合清單的物件,例如 { "name": "wrench", "mass": "1.3kg", "count": "3" }。

installationState

object (InstallationState)

僅供輸出。連線的安裝狀態。

disabled

boolean

選用。如果將 disabled 設為 true,系統會停用這項連線的功能。這個連線中存放區的存放區型 API 方法和 Webhook 處理作業將會停用。

reconciling

boolean

僅供輸出。在背景設定或更新連線時,請設為 true。

annotations

map (key: string, value: string)

選用。可讓用戶端儲存少量任意資料。

包含 "key": value 組合清單的物件,範例:{ "name": "wrench", "mass": "1.3kg", "count": "3" }。

etag

string

選用。這個核對和是由伺服器根據其他欄位的值計算得出,可能會在更新和刪除要求中傳送,確保用戶端在繼續操作前取得最新值。

uid

string

僅供輸出。系統指派給連線的專屬 ID。

cryptoKeyConfig

object (CryptoKeyConfig)

選用。加密編譯金鑰設定。這個欄位用於客戶自行管理的加密金鑰 (CMEK) 功能。

gitProxyConfig

object (GitProxyConfig)

選用。Git Proxy 功能的設定。啟用 Git Proxy 後,用戶端就能對連結中的存放區執行 Git 作業。瞭解詳情。

聯集欄位 connection_config。連線設定,視供應商類型而定。connection_config 只能是下列其中一個設定:
githubConfig

object (GitHubConfig)

連線至 github.com 的設定。

githubEnterpriseConfig

object (GitHubEnterpriseConfig)

GitHub Enterprise 執行個體連線設定。

gitlabConfig

object (GitLabConfig)

連至 gitlab.com 的設定。

gitlabEnterpriseConfig

object (GitLabEnterpriseConfig)

連線至 GitLab Enterprise 執行個體的設定。

bitbucketDataCenterConfig

object (BitbucketDataCenterConfig)

Bitbucket Data Center 執行個體的連線設定。

bitbucketCloudConfig

object (BitbucketCloudConfig)

Bitbucket Cloud 執行個體連線設定。

secureSourceManagerInstanceConfig

object (SecureSourceManagerInstanceConfig)

Secure Source Manager 執行個體連線設定。

httpConfig

object (GenericHTTPEndpointConfig)

選用。HTTP 服務供應商連線設定。

GitHubConfig

JSON 表示法
{
  "githubApp": enum (GitHubApp),
  "authorizerCredential": {
    object (OAuthCredential)
  },
  "appInstallationId": string,
  "installationUri": string
}
欄位
githubApp

enum (GitHubApp)

這是必要旗標,不可變動。安裝至 GitHub 使用者或組織的 GitHub 應用程式。

authorizerCredential

object (OAuthCredential)

選用。授權 GitHub 應用程式的帳戶 OAuth 憑證。建議使用機器人帳戶,而非真人使用者帳戶。OAuth 權杖必須與這項設定的 GitHub 應用程式連結。

appInstallationId

string (int64 format)

選用。GitHub 應用程式安裝 ID。

installationUri

string

僅供輸出。要前往的 URI,以便管理與這個 GitHubConfig 相關聯的安裝作業。

OAuthCredential

JSON 表示法
{
  "oauthTokenSecretVersion": string,
  "username": string
}
欄位
oauthTokenSecretVersion

string

這是必要旗標,SecretManager 資源,內含授權連線的 OAuth 權杖。格式:projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域密鑰)。

username

string

僅供輸出。與這個權杖相關聯的使用者名稱。

GitHubEnterpriseConfig

JSON 表示法
{
  "hostUri": string,
  "appId": string,
  "appSlug": string,
  "privateKeySecretVersion": string,
  "webhookSecretSecretVersion": string,
  "appInstallationId": string,
  "installationUri": string,
  "serviceDirectoryConfig": {
    object (ServiceDirectoryConfig)
  },
  "serverVersion": string,
  "sslCaCertificate": string,
  "organization": string
}
欄位
hostUri

string

這是必要旗標,這個連線的 GitHub Enterprise 主機 URI。

appId

string (int64 format)

選用。從資訊清單建立的 GitHub 應用程式 ID。

appSlug

string

僅供輸出。GitHub 應用程式的網址易記名稱。

privateKeySecretVersion

string

選用。SecretManager 資源,包含 GitHub 應用程式的私密金鑰,格式為 projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域性 Secret)。

webhookSecretSecretVersion

string

選用。SecretManager 資源,包含 GitHub 應用程式的 Webhook 密鑰,格式為 projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域密鑰)。

appInstallationId

string (int64 format)

選用。GitHub 應用程式安裝 ID。

installationUri

string

僅供輸出。前往這個 URI,即可管理與這個 GithubEnterpriseConfig 相關聯的安裝作業。

serviceDirectoryConfig

object (ServiceDirectoryConfig)

選用。設定使用 Service Directory 私下連線至 GitHub Enterprise 伺服器。只有在地端部署託管 GitHub Enterprise 伺服器,且無法透過公開網際網路連線時,才應設定這個項目。如果這個欄位留空,系統會透過公開網際網路呼叫 GitHub Enterprise 伺服器。

serverVersion

string

僅供輸出。安裝在 host_uri 的 GitHub Enterprise 版本。

sslCaCertificate

string

選用。用於向 GitHub Enterprise 提出要求的 SSL 憑證。

organization

string

選用。不可變動。建立 GitHub 應用程式的 GitHub Enterprise 組織。

ServiceDirectoryConfig

JSON 表示法
{
  "service": string
}
欄位
service

string

這是必要旗標,Service Directory 服務名稱。格式:projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}。

GitLabConfig

JSON 表示法
{
  "webhookSecretSecretVersion": string,
  "readAuthorizerCredential": {
    object (UserCredential)
  },
  "authorizerCredential": {
    object (UserCredential)
  }
}
欄位
webhookSecretSecretVersion

string

這是必要旗標,不可變動。SecretManager 資源,包含 GitLab 專案的 Webhook 密鑰,格式為 projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域性密鑰)。用於驗證 Webhook。

readAuthorizerCredential

object (UserCredential)

這是必要旗標,GitLab 個人存取權杖,至少具備 read_api 範圍權限和 reporter 角色。這個個人存取權杖可查看的 GitLab 專案,會控管 Developer Connect 可存取的專案。

authorizerCredential

object (UserCredential)

這是必要旗標,GitLab 個人存取權杖,至少具備 api 範圍權限和 maintainer 角色。這個個人存取權杖可查看的 GitLab 專案,會控管 Developer Connect 可存取的專案。

UserCredential

JSON 表示法
{
  "userTokenSecretVersion": string,
  "username": string
}
欄位
userTokenSecretVersion

string

這是必要旗標,SecretManager 資源,內含授權 Developer Connect 連線的使用者權杖。格式:projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域密鑰)。

username

string

僅供輸出。與這個權杖相關聯的使用者名稱。

GitLabEnterpriseConfig

JSON 表示法
{
  "hostUri": string,
  "webhookSecretSecretVersion": string,
  "readAuthorizerCredential": {
    object (UserCredential)
  },
  "authorizerCredential": {
    object (UserCredential)
  },
  "serviceDirectoryConfig": {
    object (ServiceDirectoryConfig)
  },
  "sslCaCertificate": string,
  "serverVersion": string
}
欄位
hostUri

string

這是必要旗標,這項連線的 GitLab Enterprise 主機 URI。

webhookSecretSecretVersion

string

這是必要旗標,不可變動。SecretManager 資源,包含 GitLab 專案的 Webhook 密鑰,格式為 projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域性密鑰)。用於驗證 Webhook。

readAuthorizerCredential

object (UserCredential)

這是必要旗標,GitLab 個人存取權杖,至少具備 read_api 範圍權限和 reporter 角色。這個個人存取權杖可查看的 GitLab 專案,會控管 Developer Connect 可存取的專案。

authorizerCredential

object (UserCredential)

這是必要旗標,GitLab 個人存取權杖,至少具備 api 範圍權限和 maintainer 角色。這個個人存取權杖可查看的 GitLab 專案,會控管 Developer Connect 可存取的專案。

serviceDirectoryConfig

object (ServiceDirectoryConfig)

選用。設定使用 Service Directory 私下連線至 GitLab Enterprise 執行個體。只有在 GitLab Enterprise 伺服器託管於地端部署環境,且無法透過公開網際網路連線時,才應設定這個選項。如果這個欄位留空,系統會透過公開網際網路呼叫 GitLab Enterprise 伺服器。

sslCaCertificate

string

選用。SSL 憑證授權單位憑證,用於向 GitLab Enterprise 執行個體發出要求。

serverVersion

string

僅供輸出。在 host_uri 執行的 GitLab Enterprise 伺服器版本。

BitbucketDataCenterConfig

JSON 表示法
{
  "hostUri": string,
  "webhookSecretSecretVersion": string,
  "readAuthorizerCredential": {
    object (UserCredential)
  },
  "authorizerCredential": {
    object (UserCredential)
  },
  "serviceDirectoryConfig": {
    object (ServiceDirectoryConfig)
  },
  "sslCaCertificate": string,
  "serverVersion": string
}
欄位
hostUri

string

這是必要旗標,這個連線所屬 Bitbucket 資料中心主機的 URI。

webhookSecretSecretVersion

string

這是必要旗標,不可變動。SecretManager 資源,包含用於驗證 Webhook 事件的 Webhook 密鑰,格式為 projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域性密鑰)。用於驗證 Webhook。

readAuthorizerCredential

object (UserCredential)

這是必要旗標,具有最低 Repository read 存取權的 HTTP 存取權杖。建議使用系統帳戶產生憑證。

authorizerCredential

object (UserCredential)

這是必要旗標,具有最低 Repository admin 範圍權限的 HTTP 存取權杖。必須具備這項權限,才能建立 Webhook。建議使用系統帳戶產生這些憑證。

serviceDirectoryConfig

object (ServiceDirectoryConfig)

選用。設定使用 Service Directory 私下連線至 Bitbucket 資料中心執行個體。只有在 Bitbucket 資料中心是地端部署,且無法透過公開網際網路連線時,才應設定這個值。如果這個欄位留空,系統會透過公開網際網路呼叫 Bitbucket Data Center。

sslCaCertificate

string

選用。向 Bitbucket Data Center 提出要求時,要信任的 SSL 憑證授權單位。

serverVersion

string

僅供輸出。在 host_uri 執行的 Bitbucket Data Center 伺服器版本。

BitbucketCloudConfig

JSON 表示法
{
  "workspace": string,
  "webhookSecretSecretVersion": string,
  "readAuthorizerCredential": {
    object (UserCredential)
  },
  "authorizerCredential": {
    object (UserCredential)
  }
}
欄位
workspace

string

這是必要旗標,要連結至 Google Cloud Platform 的 Bitbucket Cloud 工作區 ID。

webhookSecretSecretVersion

string

這是必要旗標,不可變動。SecretManager 資源,包含用於驗證 Webhook 事件的 Webhook 密鑰,格式為 projects/*/secrets/*/versions/* 或 projects/*/locations/*/secrets/*/versions/* (如果該位置支援區域性密鑰)。這個值會用於驗證及建立 Webhook。

readAuthorizerCredential

object (UserCredential)

這是必要旗標,具備最低 repository 存取權的存取權杖。可以是工作區、專案或存放區存取權杖。建議使用系統帳戶產生憑證。

authorizerCredential

object (UserCredential)

這是必要旗標,具有最低 repository、pullrequest 和 webhook 範圍權限的存取權杖。可以是工作區、專案或存放區存取權杖。必須具備這項權限,才能建立 Webhook。建議使用系統帳戶產生這些憑證。

SecureSourceManagerInstanceConfig

JSON 表示法
{
  "instance": string
}
欄位
instance

string

這是必要旗標,不可變動。Secure Source Manager 執行個體資源,格式為 projects/*/locations/*/instances/*

GenericHTTPEndpointConfig

JSON 表示法
{
  "hostUri": string,
  "serviceDirectoryConfig": {
    object (ServiceDirectoryConfig)
  },
  "sslCaCertificate": string,

  // Union field authentication can be only one of the following:
  "basicAuthentication": {
    object (BasicAuthentication)
  },
  "bearerTokenAuthentication": {
    object (BearerTokenAuthentication)
  }
  // End of list of possible types for union field authentication.
}
欄位
hostUri

string

這是必要旗標,不可變動。服務供應商的 HTTPS 端點。

serviceDirectoryConfig

object (ServiceDirectoryConfig)

選用。設定使用 Service Directory 私下連線至 HTTP 服務供應商。只有在 HTTP 服務供應商託管於地端部署環境,且無法透過公開網際網路連線時,才應設定這項屬性。如果這個欄位留空,系統會透過公開網際網路呼叫 HTTP 服務供應商。

sslCaCertificate

string

選用。向 HTTP 服務供應商提出要求時,要使用的 SSL 憑證。

聯集欄位 authentication。向 HTTP 服務供應商提出要求時,要使用的驗證機制。authentication 只能是下列其中一個設定:
basicAuthentication

object (BasicAuthentication)

選用。使用使用者名稱和密碼的基本驗證。

bearerTokenAuthentication

object (BearerTokenAuthentication)

選用。使用權杖進行不記名權杖驗證。

BasicAuthentication

JSON 表示法
{
  "username": string,

  // Union field password can be only one of the following:
  "passwordSecretVersion": string
  // End of list of possible types for union field password.
}
欄位
username

string

這是必要旗標,要驗證的使用者名稱。

聯集欄位 password。驗證時使用的密碼。password 只能是下列其中一個設定:
passwordSecretVersion

string

用於驗證的密碼 SecretManager 密鑰版本。

BearerTokenAuthentication

JSON 表示法
{

  // Union field token can be only one of the following:
  "tokenSecretVersion": string
  // End of list of possible types for union field token.
}
欄位
聯集欄位 token。用於驗證身分的權杖。token 只能是下列其中一個設定:
tokenSecretVersion

string

選用。用於驗證的權杖 SecretManager 密鑰版本。

時間戳記

JSON 表示法
{
  "seconds": string,
  "nanos": integer
}
欄位
seconds

string (int64 format)

代表自 Unix 紀元 1970-01-01T00:00:00Z 起算的世界標準時間秒數。必須介於 -62135596800 和 253402300799 (含) 之間 (對應 0001-01-01T00:00:00Z 至 9999-12-31T23:59:59Z)。

nanos

integer

以奈秒解析度表示的非負分數秒。這個欄位是時間長度的奈秒部分,而非秒數的替代值。含有分數的負秒值仍須有非負奈秒值,以向前計算時間。必須介於 0 至 999,999,999 之間 (含 0 和 999,999,999)。

LabelsEntry

JSON 表示法
{
  "key": string,
  "value": string
}
欄位
key

string

value

string

InstallationState

JSON 表示法
{
  "stage": enum (Stage),
  "message": string,
  "actionUri": string
}
欄位
stage

enum (Stage)

僅供輸出。安裝程序的目前步驟。

message

string

僅供輸出。使用者接下來應採取的行動,以繼續安裝。如果安裝作業已完成,則為空白字串。

actionUri

string

僅供輸出。請點選連結,瞭解後續行動。如果安裝作業已完成,則為空白字串。

AnnotationsEntry

JSON 表示法
{
  "key": string,
  "value": string
}
欄位
key

string

value

string

CryptoKeyConfig

JSON 表示法
{
  "keyReference": string
}
欄位
keyReference

string

這是必要旗標,用於加密/解密客戶資料的金鑰名稱。Cloud KMS 中的金鑰應採用 projects/*/locations/*/keyRings/*/cryptoKeys/* 格式。

GitProxyConfig

JSON 表示法
{
  "enabled": boolean,
  "httpProxyBaseUri": string
}
欄位
enabled

boolean

選用。如果設為 true,就能使用 Git Proxy,對連線中連結的存放區執行 Git 作業。

httpProxyBaseUri

string

僅供輸出。HTTP Proxy 端點的基本 URI。格式為 https://{generatedID}-c-h-{shortRegion}.developerconnect.dev。只有在 enabled 設為 true 時,系統才會填入這個欄位。其他與 Developer Connect 整合的 Google 服務會使用這個端點。

GitHubApp

代表可安裝至 GitHub 使用者或組織,並與 Developer Connect 搭配使用的各種 GitHub 應用程式。

列舉
GIT_HUB_APP_UNSPECIFIED 未指定 GitHub 應用程式。
DEVELOPER_CONNECT Developer Connect GitHub 應用程式。
FIREBASE Firebase GitHub 應用程式。
GEMINI_CODE_ASSIST Gemini Code Assist 應用程式。
DATAFORM Dataform GitHub 應用程式。

階段

安裝程序階段。

列舉
STAGE_UNSPECIFIED 未指定階段。
PENDING_CREATE_APP 僅適用於 GitHub Enterprise。已要求建立應用程式。使用者必須在 GitHub Enterprise 主機中確認建立作業。
PENDING_USER_OAUTH 使用者必須透過 OAuth 授權 GitHub (或 Enterprise) 應用程式。
PENDING_INSTALL_APP 使用者必須點選連結,安裝 GitHub (或 Enterprise) 應用程式。
COMPLETE 安裝程序已完成。

輸出內容的結構定義

這個資源代表某個網路 API 呼叫所造成長時間執行的作業。

作業

JSON 表示法
{
  "name": string,
  "metadata": {
    "@type": string,
    field1: ...,
    ...
  },
  "done": boolean,

  // Union field result can be only one of the following:
  "error": {
    object (Status)
  },
  "response": {
    "@type": string,
    field1: ...,
    ...
  }
  // End of list of possible types for union field result.
}
欄位
name

string

伺服器指派的名稱,而且只有在當初傳回這個名稱的服務中是不重複項目。如果您使用預設的 HTTP 對應,則 name 應該是以 operations/{unique_id} 結尾的資源名稱。

metadata

object

與作業相關聯的服務專屬中繼資料,通常包含進度資訊和常用中繼資料 (例如建立時間)。部分服務可能不會提供這類中繼資料。凡是會傳回長時間執行的作業的方法,都應記錄中繼資料類型 (如有)。

包含任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。例如 { "id": 1234, "@type": "types.example.com/standard/id" }。

done

boolean

如果值為 false,代表作業仍在執行中。如果值為 true,代表作業已完成,系統會顯示 error 或 response 的執行結果。

聯集欄位 result。這是作業的執行結果,可能為 error,或是有效的 response。如果 done == false,系統不會將結果設定為 error 或 response。如果 done == true,系統只能將結果設定為 error 或 response。部分服務可能不會提供結果。result 只能是下列其中一個設定:
error

object (Status)

作業失敗或取消時顯示的錯誤結果。

response

object

作業執行成功時的一般回應。如果原始方法在執行成功時沒有傳回資料 (例如 Delete),則回應為 google.protobuf.Empty。如果原始方法是標準的 Get/Create/Update,回應則應該為資源。如果是其他方法,回應必須包含類型 XxxResponse,其中 Xxx 是原始方法的名稱。舉例來說,如果原始方法的名稱為 TakeSnapshot(),您就能推測出回應類型應該是 TakeSnapshotResponse。

包含任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。範例:{ "id": 1234, "@type": "types.example.com/standard/id" }。

不限

JSON 表示法
{
  "typeUrl": string,
  "value": string
}
欄位
typeUrl

string

使用 URI 參照來識別序列化 Protobuf 訊息的類型,其中包含以斜線結尾的前置字串,以及完整類型名稱。

範例:type.googleapis.com/google.protobuf.StringValue

這個字串必須包含至少一個 / 字元,且最後一個 / 後方的內容必須是標準格式的完整類型名稱,開頭不得為點號。請勿在這些 URI 參照上寫入配置,以免用戶端嘗試與其聯絡。

前置字串可任意指定,Protobuf 實作項目應直接移除最後一個 / 之前的所有內容 (包括 ),以識別類型。type.googleapis.com/ 是常見的預設前置字元,某些舊版實作項目需要使用。這個前置字串不代表類型的來源,且包含這個前置字串的 URI 不會回應任何要求。

所有類型網址字串都必須是合法的 URI 參照,且有額外限制 (文字格式),參照內容只能包含英數字元、百分比編碼逸出字元,以及下列字元集中的字元 (不含外側反引號):/-.~_!$&()*+,;=。雖然我們允許百分比編碼,但實作時不應取消逸出,以免與現有剖析器混淆。例如,type.googleapis.com%2FFoo 應遭拒。

在 Any 的原始設計中,我們曾考慮在這些類型網址啟動類型解析服務,但 Protobuf 從未實作這項服務,並認為與這些網址通訊會造成問題,且可能引發安全性問題。請勿嘗試輸入網址。

value

string (bytes format)

保留 type_url 所述類型的 Protobuf 序列化。

Base64 編碼字串。

狀態

JSON 表示法
{
  "code": integer,
  "message": string,
  "details": [
    {
      "@type": string,
      field1: ...,
      ...
    }
  ]
}
欄位
code

integer

狀態碼,應為 google.rpc.Code 的列舉值。

message

string

向開發人員顯示的錯誤訊息,應以英文呈現。所有面向使用者的錯誤訊息都應經過本地化,並透過 google.rpc.Status.details 欄位傳送,或是由用戶端加以本地化。

details[]

object

包含錯誤詳細資料的訊息清單。這是供 API 使用的一組常用訊息類型。

包含任意類型欄位的物件。額外的 "@type" 欄位則包含能辨識類型的 URI。範例:{ "id": 1234, "@type": "types.example.com/standard/id" }。

工具註解

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

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

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

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