工具:list-connections
列出指定專案和位置中的連線。
下列程式碼範例說明如何使用 curl 呼叫 list-connections 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": "list-connections", "arguments": { // Provide these details according to the MCP tool specification. } }, "jsonrpc": "2.0", "id": 1 }' |
輸入內容的結構定義
要求連線清單的訊息
ListConnectionsRequest
| JSON 表示法 |
|---|
{ "parent": string, "pageSize": integer, "pageToken": string, "filter": string, "orderBy": string } |
| 欄位 | |
|---|---|
parent |
這是必要旗標,ListConnectionsRequest 的父項值 |
pageSize |
選用。要求的頁面大小。伺服器傳回的項目數量可能少於要求數量。如未指定,伺服器會選擇適當的預設值。 |
pageToken |
選用。用來識別伺服器應傳回哪一頁結果的權杖。 |
filter |
選用。篩選結果。 |
orderBy |
選用。結果排序方式的提示。 |
輸出內容的結構定義
回覆列出連結訊息
ListConnectionsResponse
| JSON 表示法 |
|---|
{
"connections": [
{
object ( |
| 欄位 | |
|---|---|
connections[] |
連線清單。 |
nextPageToken |
用來識別伺服器應傳回哪一頁結果的權杖。 |
unreachable[] |
無法連線的位置。 |
連線
| JSON 表示法 |
|---|
{ "name": string, "createTime": string, "updateTime": string, "deleteTime": string, "labels": { string: string, ... }, "installationState": { object ( |
| 欄位 | |
|---|---|
name |
ID。連線的資源名稱,格式為 |
createTime |
僅供輸出。建立時間戳記。 使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例: |
updateTime |
僅供輸出。更新時間戳記。 使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例: |
deleteTime |
僅供輸出。刪除時間戳記。 使用 RFC 3339,產生的輸出內容一律會經過 Z 正規化,並使用 0、3、6 或 9 個小數位數,也接受「Z」以外的偏移量。範例: |
labels |
選用。標籤 (鍵/值組合) 包含 |
installationState |
僅供輸出。連線的安裝狀態。 |
disabled |
選用。如果將 disabled 設為 true,系統會停用這項連線的功能。這個連線中存放區的存放區型 API 方法和 Webhook 處理作業將會停用。 |
reconciling |
僅供輸出。在背景設定或更新連線時,請設為 true。 |
annotations |
選用。可讓用戶端儲存少量任意資料。 包含 |
etag |
選用。這個核對和是由伺服器根據其他欄位的值計算得出,可能會在更新和刪除要求中傳送,確保用戶端在繼續操作前取得最新值。 |
uid |
僅供輸出。系統指派給連線的專屬 ID。 |
cryptoKeyConfig |
選用。加密編譯金鑰設定。這個欄位用於客戶自行管理的加密金鑰 (CMEK) 功能。 |
gitProxyConfig |
選用。Git Proxy 功能的設定。啟用 Git Proxy 後,用戶端就能對連結中的存放區執行 Git 作業。瞭解詳情。 |
聯集欄位 connection_config。連線設定,視供應商類型而定。connection_config 只能是下列其中一個設定: |
|
githubConfig |
連線至 github.com 的設定。 |
githubEnterpriseConfig |
GitHub Enterprise 執行個體連線設定。 |
gitlabConfig |
連至 gitlab.com 的設定。 |
gitlabEnterpriseConfig |
連線至 GitLab Enterprise 執行個體的設定。 |
bitbucketDataCenterConfig |
Bitbucket Data Center 執行個體的連線設定。 |
bitbucketCloudConfig |
Bitbucket Cloud 執行個體連線設定。 |
secureSourceManagerInstanceConfig |
Secure Source Manager 執行個體連線設定。 |
httpConfig |
選用。HTTP 服務供應商連線設定。 |
GitHubConfig
| JSON 表示法 |
|---|
{ "githubApp": enum ( |
| 欄位 | |
|---|---|
githubApp |
這是必要旗標,不可變動。安裝至 GitHub 使用者或組織的 GitHub 應用程式。 |
authorizerCredential |
選用。授權 GitHub 應用程式的帳戶 OAuth 憑證。建議使用機器人帳戶,而非真人使用者帳戶。OAuth 權杖必須與這項設定的 GitHub 應用程式連結。 |
appInstallationId |
選用。GitHub 應用程式安裝 ID。 |
installationUri |
僅供輸出。要前往的 URI,以便管理與這個 GitHubConfig 相關聯的安裝作業。 |
OAuthCredential
| JSON 表示法 |
|---|
{ "oauthTokenSecretVersion": string, "username": string } |
| 欄位 | |
|---|---|
oauthTokenSecretVersion |
這是必要旗標,SecretManager 資源,內含授權連線的 OAuth 權杖。格式: |
username |
僅供輸出。與這個權杖相關聯的使用者名稱。 |
GitHubEnterpriseConfig
| JSON 表示法 |
|---|
{
"hostUri": string,
"appId": string,
"appSlug": string,
"privateKeySecretVersion": string,
"webhookSecretSecretVersion": string,
"appInstallationId": string,
"installationUri": string,
"serviceDirectoryConfig": {
object ( |
| 欄位 | |
|---|---|
hostUri |
這是必要旗標,這個連線的 GitHub Enterprise 主機 URI。 |
appId |
選用。從資訊清單建立的 GitHub 應用程式 ID。 |
appSlug |
僅供輸出。GitHub 應用程式的網址易記名稱。 |
privateKeySecretVersion |
選用。SecretManager 資源,包含 GitHub 應用程式的私密金鑰,格式為 |
webhookSecretSecretVersion |
選用。SecretManager 資源,包含 GitHub 應用程式的 Webhook 密鑰,格式為 |
appInstallationId |
選用。GitHub 應用程式安裝 ID。 |
installationUri |
僅供輸出。前往這個 URI,即可管理與這個 GithubEnterpriseConfig 相關聯的安裝作業。 |
serviceDirectoryConfig |
選用。設定使用 Service Directory 私下連線至 GitHub Enterprise 伺服器。只有在地端部署託管 GitHub Enterprise 伺服器,且無法透過公開網際網路連線時,才應設定這個項目。如果這個欄位留空,系統會透過公開網際網路呼叫 GitHub Enterprise 伺服器。 |
serverVersion |
僅供輸出。安裝在 host_uri 的 GitHub Enterprise 版本。 |
sslCaCertificate |
選用。用於向 GitHub Enterprise 提出要求的 SSL 憑證。 |
organization |
選用。不可變動。建立 GitHub 應用程式的 GitHub Enterprise 組織。 |
ServiceDirectoryConfig
| JSON 表示法 |
|---|
{ "service": string } |
| 欄位 | |
|---|---|
service |
這是必要旗標,Service Directory 服務名稱。格式:projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}。 |
GitLabConfig
| JSON 表示法 |
|---|
{ "webhookSecretSecretVersion": string, "readAuthorizerCredential": { object ( |
| 欄位 | |
|---|---|
webhookSecretSecretVersion |
這是必要旗標,不可變動。SecretManager 資源,包含 GitLab 專案的 Webhook 密鑰,格式為 |
readAuthorizerCredential |
這是必要旗標,GitLab 個人存取權杖,至少具備 |
authorizerCredential |
這是必要旗標,GitLab 個人存取權杖,至少具備 |
UserCredential
| JSON 表示法 |
|---|
{ "userTokenSecretVersion": string, "username": string } |
| 欄位 | |
|---|---|
userTokenSecretVersion |
這是必要旗標,SecretManager 資源,內含授權 Developer Connect 連線的使用者權杖。格式: |
username |
僅供輸出。與這個權杖相關聯的使用者名稱。 |
GitLabEnterpriseConfig
| JSON 表示法 |
|---|
{ "hostUri": string, "webhookSecretSecretVersion": string, "readAuthorizerCredential": { object ( |
| 欄位 | |
|---|---|
hostUri |
這是必要旗標,這項連線的 GitLab Enterprise 主機 URI。 |
webhookSecretSecretVersion |
這是必要旗標,不可變動。SecretManager 資源,包含 GitLab 專案的 Webhook 密鑰,格式為 |
readAuthorizerCredential |
這是必要旗標,GitLab 個人存取權杖,至少具備 |
authorizerCredential |
這是必要旗標,GitLab 個人存取權杖,至少具備 |
serviceDirectoryConfig |
選用。設定使用 Service Directory 私下連線至 GitLab Enterprise 執行個體。只有在 GitLab Enterprise 伺服器託管於地端部署環境,且無法透過公開網際網路連線時,才應設定這個選項。如果這個欄位留空,系統會透過公開網際網路呼叫 GitLab Enterprise 伺服器。 |
sslCaCertificate |
選用。SSL 憑證授權單位憑證,用於向 GitLab Enterprise 執行個體發出要求。 |
serverVersion |
僅供輸出。在 |
BitbucketDataCenterConfig
| JSON 表示法 |
|---|
{ "hostUri": string, "webhookSecretSecretVersion": string, "readAuthorizerCredential": { object ( |
| 欄位 | |
|---|---|
hostUri |
這是必要旗標,這個連線所屬 Bitbucket 資料中心主機的 URI。 |
webhookSecretSecretVersion |
這是必要旗標,不可變動。SecretManager 資源,包含用於驗證 Webhook 事件的 Webhook 密鑰,格式為 |
readAuthorizerCredential |
這是必要旗標,具有最低 |
authorizerCredential |
這是必要旗標,具有最低 |
serviceDirectoryConfig |
選用。設定使用 Service Directory 私下連線至 Bitbucket 資料中心執行個體。只有在 Bitbucket 資料中心是地端部署,且無法透過公開網際網路連線時,才應設定這個值。如果這個欄位留空,系統會透過公開網際網路呼叫 Bitbucket Data Center。 |
sslCaCertificate |
選用。向 Bitbucket Data Center 提出要求時,要信任的 SSL 憑證授權單位。 |
serverVersion |
僅供輸出。在 |
BitbucketCloudConfig
| JSON 表示法 |
|---|
{ "workspace": string, "webhookSecretSecretVersion": string, "readAuthorizerCredential": { object ( |
| 欄位 | |
|---|---|
workspace |
這是必要旗標,要連結至 Google Cloud Platform 的 Bitbucket Cloud 工作區 ID。 |
webhookSecretSecretVersion |
這是必要旗標,不可變動。SecretManager 資源,包含用於驗證 Webhook 事件的 Webhook 密鑰,格式為 |
readAuthorizerCredential |
這是必要旗標,具備最低 |
authorizerCredential |
這是必要旗標,具有最低 |
SecureSourceManagerInstanceConfig
| JSON 表示法 |
|---|
{ "instance": string } |
| 欄位 | |
|---|---|
instance |
這是必要旗標,不可變動。Secure Source Manager 執行個體資源,格式為 |
GenericHTTPEndpointConfig
| JSON 表示法 |
|---|
{ "hostUri": string, "serviceDirectoryConfig": { object ( |
| 欄位 | |
|---|---|
hostUri |
這是必要旗標,不可變動。服務供應商的 HTTPS 端點。 |
serviceDirectoryConfig |
選用。設定使用 Service Directory 私下連線至 HTTP 服務供應商。只有在 HTTP 服務供應商託管於地端部署環境,且無法透過公開網際網路連線時,才應設定這項屬性。如果這個欄位留空,系統會透過公開網際網路呼叫 HTTP 服務供應商。 |
sslCaCertificate |
選用。向 HTTP 服務供應商提出要求時,要使用的 SSL 憑證。 |
聯集欄位 authentication。向 HTTP 服務供應商提出要求時,要使用的驗證機制。authentication 只能是下列其中一個設定: |
|
basicAuthentication |
選用。使用使用者名稱和密碼的基本驗證。 |
bearerTokenAuthentication |
選用。使用權杖進行不記名權杖驗證。 |
BasicAuthentication
| JSON 表示法 |
|---|
{ "username": string, // Union field |
| 欄位 | |
|---|---|
username |
這是必要旗標,要驗證的使用者名稱。 |
聯集欄位 password。驗證時使用的密碼。password 只能是下列其中一個設定: |
|
passwordSecretVersion |
用於驗證的密碼 SecretManager 密鑰版本。 |
BearerTokenAuthentication
| JSON 表示法 |
|---|
{ // Union field |
| 欄位 | |
|---|---|
聯集欄位 token。用於驗證身分的權杖。token 只能是下列其中一個設定: |
|
tokenSecretVersion |
選用。用於驗證的權杖 SecretManager 密鑰版本。 |
時間戳記
| JSON 表示法 |
|---|
{ "seconds": string, "nanos": integer } |
| 欄位 | |
|---|---|
seconds |
代表自 Unix 紀元 1970-01-01T00:00:00Z 起算的世界標準時間秒數。必須介於 -62135596800 和 253402300799 (含) 之間 (對應 0001-01-01T00:00:00Z 至 9999-12-31T23:59:59Z)。 |
nanos |
以奈秒解析度表示的非負分數秒。這個欄位是時間長度的奈秒部分,而非秒數的替代值。含有分數的負秒值仍須有非負奈秒值,以向前計算時間。必須介於 0 至 999,999,999 之間 (含 0 和 999,999,999)。 |
LabelsEntry
| JSON 表示法 |
|---|
{ "key": string, "value": string } |
| 欄位 | |
|---|---|
key |
|
value |
|
InstallationState
| JSON 表示法 |
|---|
{
"stage": enum ( |
| 欄位 | |
|---|---|
stage |
僅供輸出。安裝程序的目前步驟。 |
message |
僅供輸出。使用者接下來應採取的行動,以繼續安裝。如果安裝作業已完成,則為空白字串。 |
actionUri |
僅供輸出。請點選連結,瞭解後續行動。如果安裝作業已完成,則為空白字串。 |
AnnotationsEntry
| JSON 表示法 |
|---|
{ "key": string, "value": string } |
| 欄位 | |
|---|---|
key |
|
value |
|
CryptoKeyConfig
| JSON 表示法 |
|---|
{ "keyReference": string } |
| 欄位 | |
|---|---|
keyReference |
這是必要旗標,用於加密/解密客戶資料的金鑰名稱。Cloud KMS 中的金鑰應採用 |
GitProxyConfig
| JSON 表示法 |
|---|
{ "enabled": boolean, "httpProxyBaseUri": string } |
| 欄位 | |
|---|---|
enabled |
選用。如果設為 true,就能使用 Git Proxy,對連線中連結的存放區執行 Git 作業。 |
httpProxyBaseUri |
僅供輸出。HTTP Proxy 端點的基本 URI。格式為 |
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 |
安裝程序已完成。 |
工具註解
工具註解會傳送至 MCP 用戶端,說明特定工具的基本風險。大多數用戶端會將這些提示視為不受信任,但可用於決定何時向使用者傳送確認提示。
除了標題字串外,下列布林值提示的定義如下:
readOnlyHint:如果設為 true,工具不會修改環境。預設值:false。destructiveHint:如果為 true,工具可以執行破壞性動作。如果為 false,則工具只能執行附加動作。預設值:true。idempotentHint:如果設為 true,則使用相同引數重複呼叫工具,不會對環境造成額外影響。預設值:false。openWorldHint:如果設為 true,工具就能與外部實體的「開放世界」互動。如果設為 false,工具只能與內部實體互動。舉例來說,網頁搜尋工具是開放世界,而記憶工具則不是。
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌