MCP Tools Reference: dataform.googleapis.com

工具:search_files

在 Dataform 工作區中,找出符合搜尋篩選條件的檔案和目錄。

在大型存放區中依名稱或副檔名尋找檔案時,請使用這項工具,而非以 query_directory_contents 工具遞迴列出目錄。

workspace 參數值的格式必須為 projects/{project_id}/locations/{location}/repositories/{repository}/workspaces/{workspace}

filter 參數值會限制結果。篩選功能僅支援 path 欄位 (例如 path="*.sqlx"path="definitions/model.sqlx")。

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

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

輸入內容的結構定義

包含檔案搜尋要求參數的設定。

SearchFilesRequest

JSON 表示法
{
  "workspace": string,
  "pageSize": integer,
  "pageToken": string,
  "filter": string
}
欄位
workspace

string

這是必要旗標,工作區名稱。

pageSize

integer

選用。要傳回的搜尋結果數上限。伺服器傳回的項目數量可能會少於要求數量。若未指定,伺服器將會挑選適當的預設值。

pageToken

string

選用。接收自前一個 SearchFilesRequest 呼叫的網頁權杖。提供此項目即可擷取後續網頁。

進行分頁時,提供至 SearchFilesRequest 的所有其他參數 (page_size 除外) 須與提供網頁權杖的呼叫相符。

filter

string

選用。以篩選格式傳回清單的選用篩選器。目前僅支援對 path 欄位進行篩選。詳情請參閱 https://google.aip.dev/160

輸出內容的結構定義

檔案搜尋回應的用戶端表示法。

SearchFilesResponse

JSON 表示法
{
  "searchResults": [
    {
      object (SearchResult)
    }
  ],
  "nextPageToken": string
}
欄位
searchResults[]

object (SearchResult)

相符結果清單。

nextPageToken

string

選用。可做為 page_token 傳送的權杖,用於擷取後續網頁。如果省略這個欄位,就不會有後續頁面。

SearchResult

JSON 表示法
{

  // Union field entry can be only one of the following:
  "file": {
    object (FileSearchResult)
  },
  "directory": {
    object (DirectorySearchResult)
  }
  // End of list of possible types for union field entry.
}
欄位
聯集欄位 entry。項目的內容。entry 只能是下列其中一個設定:
file

object (FileSearchResult)

搜尋結果為檔案時的詳細資料。

directory

object (DirectorySearchResult)

搜尋結果為目錄時的詳細資料。

FileSearchResult

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

string

檔案系統路徑 (相對於工作區根目錄)。

DirectorySearchResult

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

string

檔案系統路徑 (相對於工作區根目錄)。

工具註解

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

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

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

破壞性提示:❌ | 等冪提示:✅ | 唯讀提示:✅ | 開放世界提示:❌