MCP Tools Reference: drivemcp.googleapis.com

เครื่องมือ: download_file_content

เรียกใช้เครื่องมือนี้เพื่อดาวน์โหลดเนื้อหาของไฟล์ในไดรฟ์เป็นสตริงที่เข้ารหัส base64

หากไฟล์เป็น MIME Type ของผลิตภัณฑ์ของ Google ไดรฟ์เอง คุณต้องระบุช่อง exportMimeType ซึ่งจะกำหนดรูปแบบของไฟล์ที่ดาวน์โหลด

หากไม่พบไฟล์ ให้ลองใช้เครื่องมืออื่นๆ เช่น search_files เพื่อค้นหาไฟล์ที่ผู้ใช้ต้องการ

หากผู้ใช้ต้องการการแสดงเนื้อหาในไดรฟ์เป็นภาษาธรรมชาติ ให้ใช้เครื่องมือ read_file_content (read_file_content ควรมีขนาดเล็กลงและแยกวิเคราะห์ได้ง่ายขึ้น)

ตัวอย่างต่อไปนี้แสดงวิธีใช้ curl เพื่อเรียกใช้เครื่องมือ download_file_content MCP

Curl Request
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

string

ต้องระบุ รหัสของไฟล์ที่จะดึงข้อมูล

exportMimeType

string

ไม่บังคับ สำหรับไฟล์ของ Google เอง ประเภท MIME ที่จะส่งออกไฟล์ หากไม่ใช่ไฟล์ของ Google ระบบจะละเว้น ค่าเริ่มต้นคือข้อความหากไม่ได้ระบุ

สคีมาเอาต์พุต

การตอบกลับสำหรับคำขอให้ดาวน์โหลดไฟล์

FileContent

การแสดง JSON
{
  "id": string,
  "title": string,
  "mimeType": string,
  "content": string
}
ช่อง
id

string

รหัสของไฟล์

title

string

ชื่อของไฟล์

mimeType

string

ประเภท MIME ของไฟล์

content

string

เนื้อหาของไฟล์ที่เข้ารหัส base64

คำอธิบายประกอบของเครื่องมือ

คำแนะนำที่อาจทำให้เกิดการเปลี่ยนแปลง: ❌ | คำแนะนำที่อาจทำให้เกิดการเปลี่ยนแปลงซ้ำได้: ✅ | คำแนะนำแบบอ่านอย่างเดียว: ✅ | คำแนะนำแบบโลกเปิด: ❌

ขอบเขตการให้สิทธิ์

ต้องใช้ขอบเขต OAuth อย่างใดอย่างหนึ่งต่อไปนี้

  • https://www.googleapis.com/auth/drive
  • https://www.googleapis.com/auth/drive.appdata
  • https://www.googleapis.com/auth/drive.file
  • https://www.googleapis.com/auth/drive.meet.readonly
  • https://www.googleapis.com/auth/drive.metadata
  • https://www.googleapis.com/auth/drive.metadata.readonly
  • https://www.googleapis.com/auth/drive.photos.readonly
  • https://www.googleapis.com/auth/drive.readonly