工具:download_file_content
调用此工具可将云端硬盘文件的内容下载为原始二进制数据(字节)。
如果文件是 Google 云端硬盘第一方 MIME 类型,则必须提供 exportMimeType 字段,该字段将决定下载文件的格式。
如果找不到该文件,请尝试使用其他工具(例如 search_files)查找用户请求的文件。
如果用户想要以自然语言表示其云端硬盘内容,请使用 read_file_content 工具(read_file_content 应该更小且更易于解析)。
以下示例演示了如何使用 curl 调用 download_file_content MCP 工具。
| Curl 请求 |
|---|
curl --location 'https://drivemcp.googleapis.com/mcp' \ --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 MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
输入架构
定义了下载文件内容的请求。
DownloadFileRequest
| JSON 表示法 |
|---|
{ "fileId": string, "exportMimeType": string } |
| 字段 | |
|---|---|
fileId |
必需。要检索的文件的 ID。 |
exportMimeType |
可选。对于 Google 原生文件,要将文件导出到的 MIME 类型,否则会被忽略。如果未指定,则默认为文本。 |
输出架构
CallToolResponse
| JSON 表示法 |
|---|
{ "common": { object ( |
| 字段 | |
|---|---|
common |
|
content[] |
|
structuredContent |
如果工具定义了输出架构,则此字段将填充。如果设置了此字段,支持结构化输出的客户端应忽略上述内容字段。 |
isError |
可选。 |
ResponseFields
| JSON 表示法 |
|---|
{
"instructions": string,
"metadata": {
object
},
"dependentRequests": {
string: {
object ( |
| 字段 | |
|---|---|
instructions |
可选。仅在任何 RPC 的初始响应中发送。 |
metadata |
用于任意边信道数据的应急出口。 |
dependentRequests |
相关请求。此字段的存在表示请求不完整,客户端必须在 dependent_responses 字段中包含这些相关请求的结果,然后再次尝试发出请求。 包含一系列 |
resumeData |
客户端的状态,用于在后续 RPC 中回显同一持久请求。 |
结构体
| JSON 表示法 |
|---|
{ "fields": { string: value, ... } } |
| 字段 | |
|---|---|
fields |
无序的动态类型值映射。 包含一系列 |
FieldsEntry
| JSON 表示法 |
|---|
{ "key": string, "value": value } |
| 字段 | |
|---|---|
key |
|
value |
|
值
| JSON 表示法 |
|---|
{ "nullValue": null, "numberValue": number, "stringValue": string, "boolValue": boolean, "structValue": { object }, "listValue": array } |
| 字段 | |
|---|---|
联合字段 kind。值的类型。kind 只能是下列其中一项: |
|
nullValue |
表示 JSON |
numberValue |
表示 JSON 数值。不得为 |
stringValue |
表示 JSON 字符串。 |
boolValue |
表示 JSON 布尔值(JSON 中的 |
structValue |
表示 JSON 对象。 |
listValue |
表示 JSON 数组。 |
ListValue
| JSON 表示法 |
|---|
{ "values": [ value ] } |
| 字段 | |
|---|---|
values[] |
动态类型值的重复字段。 |
DependentRequestsEntry
| JSON 表示法 |
|---|
{
"key": string,
"value": {
object ( |
| 字段 | |
|---|---|
key |
|
value |
|
ServerInitiatedRequest
| JSON 表示法 |
|---|
{ "samplingCreateMessage": { object ( |
| 字段 | |
|---|---|
samplingCreateMessage |
采样,如 https://modelcontextprotocol.io/specification/2025-03-26/client/sampling 中所述。 |
listRootsRequest |
根列表请求,如 https://modelcontextprotocol.io/specification/2025-03-26/client/roots 中所述。 |
notifyOnRootListUpdate |
|
elicitRequest |
根据 https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation 中的规定,征求意见。 |
SamplingCreateMessageRequest
| JSON 表示法 |
|---|
{ "messages": [ { object ( |
| 字段 | |
|---|---|
messages[] |
|
modelPreferences |
可选。 |
systemPrompt |
可选。 |
includeContext |
可选。 |
temperature |
可选。 |
maxTokens |
可选。 |
stopSequence[] |
可选。 |
SamplingMessage
| JSON 表示法 |
|---|
{ "role": enum ( |
| 字段 | |
|---|---|
role |
发送消息的角色。 |
text |
必须且只能填充以下字段中的一个。(未使用“oneof”,因为这会导致向前兼容性问题。) |
image |
|
audio |
|
TextContent
| JSON 表示法 |
|---|
{
"text": string,
"annotations": {
object ( |
| 字段 | |
|---|---|
text |
|
annotations |
可选。 |
注释
| JSON 表示法 |
|---|
{
"audience": [
enum ( |
| 字段 | |
|---|---|
audience[] |
|
priority |
必须介于 [0,1] 之间。 |
ImageContent
| JSON 表示法 |
|---|
{
"data": string,
"mimeType": string,
"annotations": {
object ( |
| 字段 | |
|---|---|
data |
使用 base64 编码的字符串。 |
mimeType |
|
annotations |
可选。 |
AudioContent
| JSON 表示法 |
|---|
{
"data": string,
"mimeType": string,
"annotations": {
object ( |
| 字段 | |
|---|---|
data |
使用 base64 编码的字符串。 |
mimeType |
|
annotations |
可选。 |
ModelPreferences
| JSON 表示法 |
|---|
{
"hints": [
{
object ( |
| 字段 | |
|---|---|
hints[] |
|
intelligencePriority |
|
speedPriority |
|
costPriority |
|
ModelHint
| JSON 表示法 |
|---|
{ "name": string } |
| 字段 | |
|---|---|
name |
可选。 |
ElicitRequest
| JSON 表示法 |
|---|
{
"message": string,
"requestedSchema": {
string: {
object ( |
| 字段 | |
|---|---|
message |
要向用户显示的消息。必填。 |
requestedSchema |
包含一系列 |
requiredFields[] |
|
RequestedSchemaEntry
| JSON 表示法 |
|---|
{
"key": string,
"value": {
object ( |
| 字段 | |
|---|---|
key |
|
value |
|
PrimitiveSchemaDefinition
| JSON 表示法 |
|---|
{ "stringSchema": { object ( |
| 字段 | |
|---|---|
stringSchema |
这些字段中只会存在一个。(未使用“oneof”,因为这会导致向前兼容性问题。) |
numberSchema |
|
booleanSchema |
|
enumSchema |
|
StringSchema
| JSON 表示法 |
|---|
{
"title": string,
"description": string,
"minLength": string,
"maxLength": string,
"format": enum ( |
| 字段 | |
|---|---|
title |
|
description |
|
minLength |
|
maxLength |
|
format |
|
NumberSchema
| JSON 表示法 |
|---|
{ "title": string, "description": string, "minimum": string, "maximum": string } |
| 字段 | |
|---|---|
title |
|
description |
|
minimum |
|
maximum |
|
BooleanSchema
| JSON 表示法 |
|---|
{ "title": string, "description": string, "default": boolean } |
| 字段 | |
|---|---|
title |
|
description |
|
default |
|
EnumSchema
| JSON 表示法 |
|---|
{ "title": string, "description": string, "enumList": [ string ], "enumNames": [ string ] } |
| 字段 | |
|---|---|
title |
|
description |
|
enumList[] |
|
enumNames[] |
|
内容
| JSON 表示法 |
|---|
{ "text": { object ( |
| 字段 | |
|---|---|
text |
非结构化结果内容。如果工具未定义输出架构,则至少会填充一个。如果工具定义了输出架构,则会填充 structured_content 字段,但为了实现向后兼容性,系统可能仍会填充其中一个字段。 这些字段中最多只能填充一个。(未使用“oneof”,因为这会导致向前兼容性问题。) |
image |
|
audio |
|
embeddedResource |
|
resourceLink |
|
EmbeddedResource
| JSON 表示法 |
|---|
{ "contents": { object ( |
| 字段 | |
|---|---|
contents |
|
annotations |
可选。 |
ResourceContents
| JSON 表示法 |
|---|
{ "uri": string, "mimeType": string, "text": string, "blob": string } |
| 字段 | |
|---|---|
uri |
|
mimeType |
|
text |
必须且只能填充以下字段中的一个。(未使用“oneof”,因为这会导致向前兼容性问题。) |
blob |
使用 base64 编码的字符串。 |
资源
| JSON 表示法 |
|---|
{
"uri": string,
"name": string,
"title": string,
"description": string,
"mimeType": string,
"annotations": {
object ( |
| 字段 | |
|---|---|
uri |
|
name |
|
title |
|
description |
可选。 |
mimeType |
可选。 |
annotations |
可选。 |
size |
可选。 |
工具注释
破坏性提示:❌ | 等幂性提示:✅ | 只读提示:✅ | 开放世界提示:❌