跳至主要内容

工具

共 22 個 @Tool,全部定義在 GoogleDriveFileOperations.kt。

:::tip 工具數量已多,先查再加 22 個工具已涵蓋檔案 CRUD、上傳下載、目錄管理、搜尋、依檔名查 ID、存在性檢查。新增功能前先確認是否已有近似工具,避免產生語意重疊的 API 讓呼叫端難以選擇。 :::

檔案操作​

工具說明
createNewFile在 Drive 建立新檔案
uploadFile將本機檔案上傳到 Drive
uploadFileToDirectory上傳到指定目錄
readFile讀取檔案內容
downloadFile下載檔案
updateFile更新檔案內容
updateFileFromLocal以本機檔案更新 Drive 檔案
renameFile更改檔案名稱
moveFile將檔案移動到指定目錄
deleteFile刪除檔案

查詢​

工具說明
listFiles獲取檔案列表
getFileById依 ID 取得檔案
getFileIdByName依檔名查詢檔案 ID
searchFiles關鍵字模糊搜尋
searchFilesInDirectory在指定目錄內搜尋檔案
searchDirectories搜尋目錄
checkFileExistsInDirectory檢查指定目錄下檔案是否存在

目錄操作​

工具說明
createDirectory在根目錄建立目錄
createDirectoryInParent在指定父目錄下建立目錄
listDirectoryContents顯示目錄中的檔案和子目錄
renameDirectory更改目錄名稱
deleteDirectory刪除目錄