MCP Tools Reference: drivemcp.googleapis.com

工具:read_file_content

调用此工具以获取 Google 云端硬盘文件的自然语言表示形式。

对于非常大的文件,文件内容可能不完整。文本表示形式会随时间变化,因此请勿对该工具返回的文本的特定格式做出假设。

支持的 MIME 类型:

  • application/vnd.google-apps.document
  • application/vnd.google-apps.presentation
  • application/vnd.google-apps.spreadsheet
  • application/pdf
  • application/msword
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • application/vnd.openxmlformats-officedocument.presentationml.presentation
  • application/vnd.oasis.opendocument.spreadsheet
  • application/vnd.oasis.opendocument.presentation
  • application/x-vnd.oasis.opendocument.text
  • image/png
  • image/jpeg
  • image/jpg

如果找不到文件,请尝试使用其他工具(例如 search_files)通过关键字查找用户请求的文件。

以下示例演示了如何使用 curl 调用 read_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": "read_file_content",
    "arguments": {
      // provide these details according to the tool MCP specification
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}'
                

输入架构

请求读取文件内容。

ReadFileContentRequest

JSON 表示法
{
  "fileId": string
}
字段
fileId

string

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

输出架构

读取文件内容的响应。

ReadFileContentResponse

JSON 表示法
{

  "fileContent": string
}
字段

联合字段 _file_content

_file_content 只能是下列其中一项:

fileContent

string

以文本格式返回的云端硬盘文件内容。

工具注释

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