MCP Tools Reference: drivemcp.googleapis.com

工具: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 '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

string

必需。要检索的文件的 ID。

exportMimeType

string

可选。对于 Google 原生文件,要将文件导出到的 MIME 类型,否则会被忽略。如果未指定,则默认为文本。

输出架构

针对文件下载请求的响应。

FileContent

JSON 表示法
{
  "id": string,
  "title": string,
  "mimeType": string,
  "content": string
}
字段
id

string

文件的 ID。

title

string

文件的标题。

mimeType

string

文件的 MIME 类型。

content

string

文件的 base64 编码内容。

工具注释

破坏性提示:❌ | 等幂性提示:✅ | 只读提示:✅ | 开放世界提示:❌