工具:download_file_content
呼叫這項工具,即可將 Google 雲端硬碟檔案的內容下載為 Base64 編碼字串。
如果檔案是 Google 雲端硬碟的第一方 MIME 類型,則必須填寫 exportMimeType 欄位,並決定下載檔案的格式。
如果找不到檔案,請嘗試使用 search_files 等其他工具,尋找使用者要求的檔案。
如果使用者想要雲端硬碟內容的自然語言表示法,請使用 read_file_content 工具 (read_file_content 應較小且易於剖析)。
下列範例示範如何使用 curl 叫用 download_file_content MCP 工具。
| Curl 要求 |
|---|
curl --location 'https://drivemcp.googleapis.com/mcp/v1' \ --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "download_file_content", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
輸入內容的結構定義
定義下載檔案內容的要求。
DownloadFileRequest
| JSON 表示法 |
|---|
{ "fileId": string, "exportMimeType": string } |
| 欄位 | |
|---|---|
fileId |
必填。要擷取的檔案 ID。 |
exportMimeType |
(選用步驟) 如果是 Google 原生檔案,則為要匯出檔案的 MIME 類型,否則會遭到忽略。如未指定,預設為文字。 |
輸出內容的結構定義
檔案下載要求的回應。
FileContent
| JSON 表示法 |
|---|
{ "id": string, "title": string, "mimeType": string, "content": string } |
| 欄位 | |
|---|---|
id |
檔案的 ID。 |
title |
檔案標題。 |
mimeType |
檔案的 MIME 類型。 |
content |
檔案的 Base64 編碼內容。 |
工具註解
破壞性提示:❌ | 等冪提示:✅ | 唯讀提示:✅ | 開放世界提示:❌
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/drive.meet.readonlyhttps://www.googleapis.com/auth/drive.metadatahttps://www.googleapis.com/auth/drive.metadata.readonlyhttps://www.googleapis.com/auth/drive.photos.readonlyhttps://www.googleapis.com/auth/drive.readonly