diff --git a/app/en/mcp-servers/productivity/google-drive/page.mdx b/app/en/mcp-servers/productivity/google-drive/page.mdx index 390812b8f..f6d20d142 100644 --- a/app/en/mcp-servers/productivity/google-drive/page.mdx +++ b/app/en/mcp-servers/productivity/google-drive/page.mdx @@ -12,19 +12,22 @@ import ToolFooter from "@/app/_components/tool-footer"; import { Callout } from "nextra/components"; -The GoogleDrive MCP Server provides a set of tools for interacting with Google Drive, enabling users to efficiently manage and access their files. With this MCP Sever, users can: +The Google Drive MCP Server provides a set of tools for interacting with Google Drive, enabling users to efficiently manage and access their files. With this MCP Server, users can: -- Retrieve the file and folder structure of their Google Drive. -- Generate a Google File Picker URL for user-driven file selection and authorization, allowing secure access to files. -- Search for specific files within Google Drive. +- Retrieve the file and folder structure of their Google Drive +- Search for specific files within Google Drive +- Create, rename, and move files and folders +- Download and upload files +- Share files with other users +- Generate a Google File Picker URL for user-driven file selection and authorization ## Available Tools @@ -43,7 +46,14 @@ The GoogleDrive MCP Server provides a set of tools for interacting with Google D "GoogleDrive.GenerateGoogleFilePickerUrl", "Generate a Google File Picker URL for user-driven file selection and authorization.", ], - ["GoogleDrive.SearchFiles", "Search for files in Google Drive"], + ["GoogleDrive.SearchFiles", "Search for files in Google Drive."], + ["GoogleDrive.CreateFolder", "Create a new folder in Google Drive."], + ["GoogleDrive.RenameFile", "Rename a file or folder in Google Drive."], + ["GoogleDrive.MoveFile", "Move a file or folder to a different folder."], + ["GoogleDrive.DownloadFile", "Download a file from Google Drive."], + ["GoogleDrive.DownloadFileChunk", "Download a specific byte range of a file (for large files)."], + ["GoogleDrive.UploadFile", "Upload a file to Google Drive from a URL."], + ["GoogleDrive.ShareFile", "Share a file or folder with specific people."], ]} /> @@ -72,7 +82,7 @@ The GoogleDrive MCP Server provides a set of tools for interacting with Google D ]} /> -Get comprehensive user profile and Google Drive environment information. +Get comprehensive user profile and Google Drive environment information. This tool provides detailed information about the authenticated user including their name, email, profile picture, Google Drive storage information, and the shared drives (and their IDs) the user has access to. **Parameters** @@ -99,15 +109,17 @@ This tool does not take any parameters. ]} /> -Get the file/folder tree structure of the user's Google Drive. +Get the file/folder tree structure of the user's Google Drive. This operation can be inefficient for large drives, so use with caution. **Parameters** -- **include_shared_drives** (`boolean`, optional) Whether to include shared drives in the file tree structure. Defaults to False. -- **restrict_to_shared_drive_id** (`string`, optional) If provided, only include files from this shared drive in the file tree structure. Defaults to None, which will include files and folders from all drives. -- **include_organization_domain_documents** (`boolean`, optional) Whether to include documents from the organization's domain. This is applicable to admin users who have permissions to view organization-wide documents in a Google Workspace account. Defaults to False. -- **order_by** (`Enum` [OrderBy](/mcp-servers/productivity/google-drive/reference#OrderBy), optional) Sort order. Defaults to listing the most recently modified documents first -- **limit** (`integer`, optional) The number of files and folders to list. Defaults to None, which will list all files and folders. +- **include_shared_drives** (`boolean`, optional): Whether to include shared drives in the file tree structure. Defaults to False. +- **restrict_to_shared_drive_id** (`string`, optional): If provided, only include files from this shared drive in the file tree structure. Defaults to None, which will include files and folders from all drives. +- **include_organization_domain_documents** (`boolean`, optional): Whether to include documents from the organization's domain. This is applicable to admin users who have permissions to view organization-wide documents in a Google Workspace account. Defaults to False. +- **order_by** (`Enum` [OrderBy](/mcp-servers/productivity/google-drive/reference#OrderBy), optional): Sort order. Defaults to listing the most recently modified documents first. +- **limit** (`integer`, optional): The number of files and folders to list. Defaults to None, which will list all files and folders. + +--- ## GoogleDrive.GenerateGoogleFilePickerUrl @@ -128,12 +140,16 @@ Get the file/folder tree structure of the user's Google Drive. ]} /> -Generate a Google File Picker URL for user-driven file selection and authorization. +Generate a Google File Picker URL for user-driven file selection and authorization. This tool generates a URL that directs the end-user to a Google File Picker interface where they can select or upload Google Drive files. Users can grant permission to access their Drive files, providing a secure and authorized way to interact with their files. + +This is particularly useful when prior tools encountered failures due to file non-existence or permission errors. Once the user completes the file picker flow, the prior tool can be retried. **Parameters** This tool does not take any parameters. +--- + ## GoogleDrive.SearchFiles
@@ -153,20 +169,251 @@ This tool does not take any parameters. ]} /> -Search for files in Google Drive +Search for files in Google Drive. The provided query should only contain the search terms; the tool will construct the full search query for you. + +**Parameters** + +- **query** (`string`, required): The search query to find files in Google Drive. Will search for filenames and file contents that match the provided query. +- **folder_path_or_id** (`string`, optional): Search only within this specific folder. Provide either a path like `folder/subfolder` or a folder ID. If None, searches across all accessible locations. Defaults to None. +- **shared_drive_id** (`string`, optional): If provided, search only within this shared drive. Defaults to None (searches My Drive and optionally all shared drives). +- **include_shared_drives** (`boolean`, optional): If True and shared_drive_id is not set, include all shared drives in search. Defaults to False (My Drive only). +- **include_organization_domain_documents** (`boolean`, optional): Whether to include documents from the organization's domain. This is applicable to admin users who have permissions to view organization-wide documents in a Google Workspace account. Defaults to False. +- **order_by** (`Enum` [OrderBy](/mcp-servers/productivity/google-drive/reference#OrderBy), optional): Sort order for search results. Defaults to listing the most recently modified documents first. If the query contains `fullText`, then the order_by will be ignored. +- **limit** (`integer`, optional): The maximum number of search results to return. Defaults to 50. +- **file_types** (`Enum` [GoogleDriveFileType](/mcp-servers/productivity/google-drive/reference#GoogleDriveFileType), optional): Filter by specific file types. Defaults to None, which includes all file types. + +--- + +## GoogleDrive.CreateFolder + +
+ + +Create a new folder in Google Drive. By default, parent folder paths are resolved in My Drive. For shared drives, use folder IDs or provide shared_drive_id. + +**Parameters** + +- **folder_name** (`string`, required): The name of the new folder to create. +- **parent_folder_path_or_id** (`string`, optional): The parent folder path like `folder/subfolder` or folder ID where to create. If None, creates at the root of My Drive. If providing a path, it will be resolved within My Drive by default. Do not include the folder to create in this path. Defaults to None. +- **shared_drive_id** (`string`, optional): If creating in a shared drive and using a parent folder path, provide the shared drive ID. Not needed when using folder IDs or creating in My Drive. Defaults to None. + +--- + +## GoogleDrive.RenameFile + +
+ + +Rename a file or folder in Google Drive. By default, paths are resolved in My Drive. For files in shared drives, either use the file ID directly or provide the shared_drive_id parameter. + +**Parameters** + +- **file_path_or_id** (`string`, required): The path like `folder/subfolder/filename` or the file ID to rename. If providing a path, it will be resolved within My Drive by default. +- **new_filename** (`string`, required): The new name for the file. +- **shared_drive_id** (`string`, optional): If the file is in a shared drive and you're using a path (not ID), provide the shared drive ID to resolve the path within that drive. Not needed when using file IDs. Defaults to None (searches My Drive). + +--- + +## GoogleDrive.MoveFile + +
+ + +Move a file or folder to a different folder within the same Google Drive. Can move to a folder (keeping name), or move and rename in one operation. By default, paths are resolved in My Drive. For shared drives, use file IDs or provide shared_drive_id. + +**Parameters** + +- **source_file_path_or_id** (`string`, required): The source file path like `folder/subfolder/filename` or the file ID of the file to move. If providing a path, it will be resolved within My Drive by default. +- **destination_folder_path_or_id** (`string`, required): The path to the file's parent folder (exclude the file to be moved) or parent folder ID to move the file into. +- **new_filename** (`string`, optional): Optional new name for the file after moving. If None, keeps the original name. Defaults to None. +- **shared_drive_id** (`string`, optional): If working with paths in a shared drive, provide the shared drive ID. Not needed when using IDs. Defaults to None (uses My Drive). + +--- + +## GoogleDrive.DownloadFile + +
+ + + + DO NOT feed this tool's response to a language model. The response is too large. Instead, let the language model select this tool, and then directly execute the tool, decode its response, and then save the contents to a local file. + + + This tool is intended to be used in conjunction with `DownloadFileChunk`. + + +Download a blob file (non-workspace file) from Google Drive as base64 encoded content. For small files (under ~5MB raw), returns the file content directly in the response as base64. For large files, returns metadata with `requires_chunked_download=True` - use `DownloadFileChunk` to retrieve the file in parts. + +**Parameters** + +- **file_path_or_id** (`string`, required): The file path like `folder/subfolder/filename` or the file ID of the file to download. Folders NOT supported. If providing a path, it will be resolved within My Drive by default. +- **shared_drive_id** (`string`, optional): If the file is in a shared drive and using a path, provide the shared drive ID. Not needed when using file IDs. Defaults to None (uses My Drive). + +--- + +## GoogleDrive.DownloadFileChunk + +
+ + + + DO NOT feed this tool's response to a language model. The response is too large. Instead, let the language model select this tool, and then directly execute the tool, decode its response, and then save the contents to a local file. + + + + This tool is intended to be used in conjunction with `DownloadFile`. + + +Download a specific byte range of a file from Google Drive. Use this for large files that require chunked download (when `DownloadFile` returns `requires_chunked_download=True`). Call repeatedly with increasing `start_byte` values to retrieve the complete file. + +Returns the chunk content as base64, along with progress information including whether this is the final chunk. + +**Parameters** + +- **file_path_or_id** (`string`, required): The file path like `folder/subfolder/filename` or the file ID to download a chunk from. If providing a path, it will be resolved within My Drive by default. +- **start_byte** (`integer`, required): The starting byte position for this chunk (0-indexed). +- **chunk_size** (`integer`, optional): The size of the chunk to download in bytes. Max 5MB (5242880). Defaults to 5MB (5242880). +- **shared_drive_id** (`string`, optional): If the file is in a shared drive and using a path, provide the shared drive ID. Not needed when using file IDs. Defaults to None (uses My Drive). + +--- + +## GoogleDrive.UploadFile + +
+ + +Upload a file to Google Drive from a URL. Fetches the file content from the provided URL and uploads it to Google Drive. Supports files of any size - uses resumable upload internally for large files. + + + This tool cannot upload Google Workspace files (Google Docs, Sheets, Slides). Only regular files are supported. + + +**Parameters** + +- **file_name** (`string`, required): The name for the uploaded file. +- **source_url** (`string`, required): The public download URL to fetch the file content from. The tool will download from this URL and upload to Google Drive. +- **mime_type** (`Enum` [UploadMimeType](/mcp-servers/productivity/google-drive/reference#UploadMimeType), optional): The file type. If not provided, will be inferred from the URL or Content-Type header. Supported: text (txt, csv, json, html, md), pdf, images (png, jpeg, gif). Defaults to None (auto-detect). +- **destination_folder_path_or_id** (`string`, optional): The folder path like `folder/subfolder` or folder ID where to upload. If None, uploads to the root of My Drive. If providing a path, it will be resolved within My Drive by default. Defaults to None. +- **shared_drive_id** (`string`, optional): If uploading to a folder in a shared drive using a path, provide the shared drive ID. Not needed when using folder IDs or uploading to My Drive. Defaults to None (My Drive). + +--- + +## GoogleDrive.ShareFile + +
+ + +Share a file or folder in Google Drive with specific people by granting them permissions. If a user already has permission on the file, their role will be updated to the new role. By default, paths are resolved in My Drive. For shared drives, use file IDs or provide shared_drive_id. **Parameters** -- **query** (`string`, required) The search query to use to find files in Google DriveThis can include document titles or body content. -- **include_shared_drives** (`boolean`, optional) Whether to include shared drives in the search. Defaults to False. -- **restrict_to_shared_drive_id** (`string`, optional) If provided, only search files from this shared drive. Defaults to None, which will search files from all drives. -- **include_organization_domain_documents** (`boolean`, optional) Whether to include documents from the organization's domain. This is applicable to admin users who have permissions to view organization-wide documents in a Google Workspace account. Defaults to False. -- **order_by** (`Enum` [OrderBy](/mcp-servers/productivity/google-drive/reference#OrderBy), optional) Sort order for search results. Defaults to listing the most recently modified documents first -- **limit** (`integer`, optional) The maximum number of search results to return. Defaults to 50. -- **file_types** (`Enum` [GoogleDriveFileType](/mcp-servers/productivity/google-drive/reference#GoogleDriveFileType), optional) Filter by specific file types. Defaults to None, which includes all file types. +- **file_path_or_id** (`string`, required): The file path like `folder/subfolder/filename` or the file ID to share. If providing a path, it will be resolved within My Drive by default. +- **email_addresses** (`list[string]`, required): List of email addresses like `user@domain.com` to share with. +- **role** (`Enum` [PermissionRole](/mcp-servers/productivity/google-drive/reference#PermissionRole), optional): The permission role to grant. Defaults to `reader` (view-only). +- **send_notification_email** (`boolean`, optional): Whether to send an email notification to the recipients. Defaults to True. +- **message** (`string`, optional): Optional message to include in the notification email. Defaults to None. +- **shared_drive_id** (`string`, optional): If the file is in a shared drive and using a path, provide the shared drive ID. Not needed when using file IDs. Defaults to None (uses My Drive). ## Auth -The Arcade GoogleDrive MCP Sever uses the [Google auth provider](/home/auth-providers/google) to connect to users' GoogleDrive accounts. Please refer to the [Google auth provider](/home/auth-providers/google) documentation to learn how to configure auth. +The Arcade Google Drive MCP Server uses the [Google auth provider](/home/auth-providers/google) to connect to users' Google Drive accounts. Please refer to the [Google auth provider](/home/auth-providers/google) documentation to learn how to configure auth. diff --git a/app/en/mcp-servers/productivity/google-drive/reference/page.mdx b/app/en/mcp-servers/productivity/google-drive/reference/page.mdx index 1c5e498c4..6a5c66747 100644 --- a/app/en/mcp-servers/productivity/google-drive/reference/page.mdx +++ b/app/en/mcp-servers/productivity/google-drive/reference/page.mdx @@ -1,45 +1,80 @@ -# GoogleDrive Reference +# Google Drive Reference -Below is a reference of enumerations used by some tools in the GoogleDrive MCP Server: +Below is a reference of enumerations used by some tools in the Google Drive MCP Server: ## OrderBy -- **CREATED_TIME**: `createdTime` -- **CREATED_TIME_DESC**: `createdTime desc` -- **FOLDER**: `folder` -- **FOLDER_DESC**: `folder desc` -- **MODIFIED_BY_ME_TIME**: `modifiedByMeTime` -- **MODIFIED_BY_ME_TIME_DESC**: `modifiedByMeTime desc` -- **MODIFIED_TIME**: `modifiedTime` -- **MODIFIED_TIME_DESC**: `modifiedTime desc` -- **NAME**: `name` -- **NAME_DESC**: `name desc` -- **NAME_NATURAL**: `name_natural` -- **NAME_NATURAL_DESC**: `name_natural desc` -- **QUOTA_BYTES_USED**: `quotaBytesUsed` -- **QUOTA_BYTES_USED_DESC**: `quotaBytesUsed desc` -- **RECENCY**: `recency` -- **RECENCY_DESC**: `recency desc` -- **SHARED_WITH_ME_TIME**: `sharedWithMeTime` -- **SHARED_WITH_ME_TIME_DESC**: `sharedWithMeTime desc` -- **STARRED**: `starred` -- **STARRED_DESC**: `starred desc` -- **VIEWED_BY_ME_TIME**: `viewedByMeTime` -- **VIEWED_BY_ME_TIME_DESC**: `viewedByMeTime desc` +Sort order options for listing and searching files. + +- **CREATED_TIME**: `createdTime` - When the file was created (ascending) +- **CREATED_TIME_DESC**: `createdTime desc` - When the file was created (descending) +- **FOLDER**: `folder` - The folder ID, sorted using alphabetical ordering (ascending) +- **FOLDER_DESC**: `folder desc` - The folder ID, sorted using alphabetical ordering (descending) +- **MODIFIED_BY_ME_TIME**: `modifiedByMeTime` - The last time the file was modified by the user (ascending) +- **MODIFIED_BY_ME_TIME_DESC**: `modifiedByMeTime desc` - The last time the file was modified by the user (descending) +- **MODIFIED_TIME**: `modifiedTime` - The last time the file was modified by anyone (ascending) +- **MODIFIED_TIME_DESC**: `modifiedTime desc` - The last time the file was modified by anyone (descending) +- **NAME**: `name` - The name of the file, sorted alphabetically (ascending) +- **NAME_DESC**: `name desc` - The name of the file, sorted alphabetically (descending) +- **NAME_NATURAL**: `name_natural` - The name of the file, sorted using natural sort ordering (ascending) +- **NAME_NATURAL_DESC**: `name_natural desc` - The name of the file, sorted using natural sort ordering (descending) +- **QUOTA_BYTES_USED**: `quotaBytesUsed` - The number of storage quota bytes used by the file (ascending) +- **QUOTA_BYTES_USED_DESC**: `quotaBytesUsed desc` - The number of storage quota bytes used by the file (descending) +- **RECENCY**: `recency` - The most recent timestamp from the file's date-time fields (ascending) +- **RECENCY_DESC**: `recency desc` - The most recent timestamp from the file's date-time fields (descending) +- **SHARED_WITH_ME_TIME**: `sharedWithMeTime` - When the file was shared with the user (ascending) +- **SHARED_WITH_ME_TIME_DESC**: `sharedWithMeTime desc` - When the file was shared with the user (descending) +- **STARRED**: `starred` - Whether the user has starred the file (ascending) +- **STARRED_DESC**: `starred desc` - Whether the user has starred the file (descending) +- **VIEWED_BY_ME_TIME**: `viewedByMeTime` - The last time the file was viewed by the user (ascending) +- **VIEWED_BY_ME_TIME_DESC**: `viewedByMeTime desc` - The last time the file was viewed by the user (descending) ## GoogleDriveFileType -- **SPREADSHEET**: `spreadsheet` -- **SLIDES**: `slides` -- **DOCUMENT**: `document` -- **DRAWING**: `drawing` -- **FORM**: `form` -- **FOLDER**: `folder` -- **IMAGE**: `image` -- **VIDEO**: `video` -- **AUDIO**: `audio` -- **SCRIPT**: `script` -- **SITES**: `sites` -- **PDF**: `pdf` +File type filters for searching files. + +- **SPREADSHEET**: `spreadsheet` - Google Sheets +- **SLIDES**: `slides` - Google Slides presentations +- **DOCUMENT**: `document` - Google Docs +- **DRAWING**: `drawing` - Google Drawings +- **FORM**: `form` - Google Forms +- **FOLDER**: `folder` - Folders +- **IMAGE**: `image` - Image files (JPEG, PNG, GIF, WebP) +- **VIDEO**: `video` - Video files (MP4, MPEG, QuickTime, WebM) +- **AUDIO**: `audio` - Audio files (MP3, M4A, WAV) +- **SCRIPT**: `script` - Google Apps Script +- **SITES**: `sites` - Google Sites +- **PDF**: `pdf` - PDF documents + +## PermissionRole + +Permission roles for sharing Google Drive files and folders. + +- **READER**: `reader` - Can view and download +- **COMMENTER**: `commenter` - Can view, download, and comment +- **WRITER**: `writer` - Can view, download, comment, and edit +- **OWNER**: `owner` - Full control (transfer ownership) + +## UploadMimeType + +Supported file types for uploading to Google Drive. This tool can only upload regular files - it cannot create Google Workspace files (Google Docs, Sheets, Slides). + +### Text-based files + +- **PLAIN_TEXT**: `text/plain` - .txt files +- **CSV**: `text/csv` - .csv spreadsheet data +- **JSON**: `application/json` - .json data files +- **HTML**: `text/html` - .html web pages +- **MARKDOWN**: `text/markdown` - .md documentation + +### Documents + +- **PDF**: `application/pdf` - .pdf documents +### Images +- **PNG**: `image/png` - .png images +- **JPEG**: `image/jpeg` - .jpg/.jpeg images +- **GIF**: `image/gif` - .gif images +- **WEBP**: `image/webp` - .webp images +- **SVG**: `image/svg+xml` - .svg vector graphics diff --git a/public/examples/integrations/mcp-servers/google_drive/create_folder_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/create_folder_example_call_tool.js new file mode 100644 index 000000000..393b7e661 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/create_folder_example_call_tool.js @@ -0,0 +1,30 @@ +import { Arcade } from "@arcadeai/arcadejs"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "{arcade_user_id}"; +const TOOL_NAME = "GoogleDrive.CreateFolder"; + +// Start the authorization process +const authResponse = await client.tools.authorize({tool_name: TOOL_NAME, user_id: USER_ID}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +const toolInput = { + "folder_name": "My New Folder", + "parent_folder_path_or_id": "Projects/2024" +}; + +const response = await client.tools.execute({ + tool_name: TOOL_NAME, + input: toolInput, + user_id: USER_ID, +}); + +console.log(JSON.stringify(response.output.value, null, 2)); + diff --git a/public/examples/integrations/mcp-servers/google_drive/create_folder_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/create_folder_example_call_tool.py new file mode 100644 index 000000000..fbda29ebe --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/create_folder_example_call_tool.py @@ -0,0 +1,28 @@ +import json +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "{arcade_user_id}" +TOOL_NAME = "GoogleDrive.CreateFolder" + +auth_response = client.tools.authorize(tool_name=TOOL_NAME, user_id=USER_ID) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +tool_input = { + "folder_name": "My New Folder", + "parent_folder_path_or_id": "Projects/2024" +} + +response = client.tools.execute( + tool_name=TOOL_NAME, + input=tool_input, + user_id=USER_ID, +) +print(json.dumps(response.output.value, indent=2)) + diff --git a/public/examples/integrations/mcp-servers/google_drive/download_file_chunk_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/download_file_chunk_example_call_tool.js new file mode 100644 index 000000000..2c4113b17 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/download_file_chunk_example_call_tool.js @@ -0,0 +1,112 @@ +import { Arcade } from "@arcadeai/arcadejs"; +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "{arcade_user_id}"; +const FILE_ID = "Projects/report.pdf"; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +// Authorize for download tools +const authResponse = await client.tools.authorize({ + tool_name: "GoogleDrive.DownloadFile", + user_id: USER_ID, +}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +// Step 1: Call download_file to get file info and possibly content +console.log(`Downloading file: ${FILE_ID}`); +const response = await client.tools.execute({ + tool_name: "GoogleDrive.DownloadFile", + input: { file_path_or_id: FILE_ID }, + user_id: USER_ID, +}); + +// Check for errors in the response +if (response.output.error) { + console.error(`Error: ${response.output.error}`); + process.exit(1); +} + +const result = response.output.value; +if (!result) { + console.error(`Unexpected response: ${JSON.stringify(response)}`); + process.exit(1); +} + +console.log(`File name: ${result.name}`); +console.log(`MIME type: ${result.mimeType}`); +console.log(`Size: ${result.size || "unknown"} bytes`); + +// Get file extension from the original filename +const originalName = result.name; +const ext = path.extname(originalName) || ".bin"; +const outputPath = path.join(__dirname, `downloaded_file${ext}`); + +let fileContent; + +// Step 2: Check if chunked download is required +if (result.requires_chunked_download) { + console.log("\nFile requires chunked download. Downloading in chunks..."); + const chunkSize = result.recommended_chunk_size; + + // Collect all chunks + const chunks = []; + let startByte = 0; + + while (true) { + console.log(`Downloading chunk starting at byte ${startByte}...`); + const chunkResponse = await client.tools.execute({ + tool_name: "GoogleDrive.DownloadFileChunk", + input: { + file_path_or_id: FILE_ID, + start_byte: startByte, + chunk_size: chunkSize, + }, + user_id: USER_ID, + }); + + if (chunkResponse.output.error) { + console.error(`Error downloading chunk: ${chunkResponse.output.error}`); + process.exit(1); + } + + const chunkResult = chunkResponse.output.value; + if (!chunkResult) { + console.error(`Unexpected chunk response: ${JSON.stringify(chunkResponse)}`); + process.exit(1); + } + + const chunkContent = Buffer.from(chunkResult.content, "base64"); + chunks.push(chunkContent); + + console.log(`Progress: ${chunkResult.progress_percent}%`); + + if (chunkResult.is_final_chunk) { + break; + } + + startByte = chunkResult.next_start_byte; + } + + // Combine all chunks + fileContent = Buffer.concat(chunks); +} else { + // Small file - content is included directly + console.log("\nFile content received directly (small file)."); + fileContent = Buffer.from(result.content, "base64"); +} + +// Save the file +fs.writeFileSync(outputPath, fileContent); + +console.log(`\nFile saved to: ${outputPath}`); +console.log(`Total bytes written: ${fileContent.length}`); diff --git a/public/examples/integrations/mcp-servers/google_drive/download_file_chunk_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/download_file_chunk_example_call_tool.py new file mode 100644 index 000000000..96d981570 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/download_file_chunk_example_call_tool.py @@ -0,0 +1,104 @@ +import base64 +import os + +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "{arcade_user_id}" +FILE_ID = "Projects/report.pdf" +OUTPUT_DIR = os.path.dirname(os.path.abspath(__file__)) + +# Authorize for download tools +auth_response = client.tools.authorize(tool_name="GoogleDrive.DownloadFile", user_id=USER_ID) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +# Step 1: Call download_file to get file info and possibly content +print(f"Downloading file: {FILE_ID}") +response = client.tools.execute( + tool_name="GoogleDrive.DownloadFile", + input={"file_path_or_id": FILE_ID}, + user_id=USER_ID, +) + +# Check for errors in the response +if response.output.error: + print(f"Error: {response.output.error}") + exit(1) + +result = response.output.value +if result is None: + print(f"Unexpected response: {response}") + exit(1) + +print(f"File name: {result['name']}") +print(f"MIME type: {result['mimeType']}") +print(f"Size: {result.get('size', 'unknown')} bytes") + +# Get file extension from the original filename +original_name = result["name"] +_, ext = os.path.splitext(original_name) +if not ext: + ext = ".bin" # Default extension if none found + +output_path = os.path.join(OUTPUT_DIR, f"downloaded_file{ext}") + +# Step 2: Check if chunked download is required +if result.get("requires_chunked_download"): + print("\nFile requires chunked download. Downloading in chunks...") + total_size = result["total_size_bytes"] + chunk_size = result["recommended_chunk_size"] + + # Collect all chunks + chunks = [] + start_byte = 0 + + while True: + print(f"Downloading chunk starting at byte {start_byte}...") + chunk_response = client.tools.execute( + tool_name="GoogleDrive.DownloadFileChunk", + input={ + "file_path_or_id": FILE_ID, + "start_byte": start_byte, + "chunk_size": chunk_size, + }, + user_id=USER_ID, + ) + + if chunk_response.output.error: + print(f"Error downloading chunk: {chunk_response.output.error}") + exit(1) + + chunk_result = chunk_response.output.value + if chunk_result is None: + print(f"Unexpected chunk response: {chunk_response}") + exit(1) + + chunk_content = base64.b64decode(chunk_result["content"]) + chunks.append(chunk_content) + + print(f"Progress: {chunk_result['progress_percent']}%") + + if chunk_result["is_final_chunk"]: + break + + start_byte = chunk_result["next_start_byte"] + + # Combine all chunks and save + file_content = b"".join(chunks) +else: + # Small file - content is included directly + print("\nFile content received directly (small file).") + file_content = base64.b64decode(result["content"]) + +# Save the file +with open(output_path, "wb") as f: + f.write(file_content) + +print(f"\nFile saved to: {output_path}") +print(f"Total bytes written: {len(file_content)}") diff --git a/public/examples/integrations/mcp-servers/google_drive/download_file_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/download_file_example_call_tool.js new file mode 100644 index 000000000..2c4113b17 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/download_file_example_call_tool.js @@ -0,0 +1,112 @@ +import { Arcade } from "@arcadeai/arcadejs"; +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "{arcade_user_id}"; +const FILE_ID = "Projects/report.pdf"; +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +// Authorize for download tools +const authResponse = await client.tools.authorize({ + tool_name: "GoogleDrive.DownloadFile", + user_id: USER_ID, +}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +// Step 1: Call download_file to get file info and possibly content +console.log(`Downloading file: ${FILE_ID}`); +const response = await client.tools.execute({ + tool_name: "GoogleDrive.DownloadFile", + input: { file_path_or_id: FILE_ID }, + user_id: USER_ID, +}); + +// Check for errors in the response +if (response.output.error) { + console.error(`Error: ${response.output.error}`); + process.exit(1); +} + +const result = response.output.value; +if (!result) { + console.error(`Unexpected response: ${JSON.stringify(response)}`); + process.exit(1); +} + +console.log(`File name: ${result.name}`); +console.log(`MIME type: ${result.mimeType}`); +console.log(`Size: ${result.size || "unknown"} bytes`); + +// Get file extension from the original filename +const originalName = result.name; +const ext = path.extname(originalName) || ".bin"; +const outputPath = path.join(__dirname, `downloaded_file${ext}`); + +let fileContent; + +// Step 2: Check if chunked download is required +if (result.requires_chunked_download) { + console.log("\nFile requires chunked download. Downloading in chunks..."); + const chunkSize = result.recommended_chunk_size; + + // Collect all chunks + const chunks = []; + let startByte = 0; + + while (true) { + console.log(`Downloading chunk starting at byte ${startByte}...`); + const chunkResponse = await client.tools.execute({ + tool_name: "GoogleDrive.DownloadFileChunk", + input: { + file_path_or_id: FILE_ID, + start_byte: startByte, + chunk_size: chunkSize, + }, + user_id: USER_ID, + }); + + if (chunkResponse.output.error) { + console.error(`Error downloading chunk: ${chunkResponse.output.error}`); + process.exit(1); + } + + const chunkResult = chunkResponse.output.value; + if (!chunkResult) { + console.error(`Unexpected chunk response: ${JSON.stringify(chunkResponse)}`); + process.exit(1); + } + + const chunkContent = Buffer.from(chunkResult.content, "base64"); + chunks.push(chunkContent); + + console.log(`Progress: ${chunkResult.progress_percent}%`); + + if (chunkResult.is_final_chunk) { + break; + } + + startByte = chunkResult.next_start_byte; + } + + // Combine all chunks + fileContent = Buffer.concat(chunks); +} else { + // Small file - content is included directly + console.log("\nFile content received directly (small file)."); + fileContent = Buffer.from(result.content, "base64"); +} + +// Save the file +fs.writeFileSync(outputPath, fileContent); + +console.log(`\nFile saved to: ${outputPath}`); +console.log(`Total bytes written: ${fileContent.length}`); diff --git a/public/examples/integrations/mcp-servers/google_drive/download_file_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/download_file_example_call_tool.py new file mode 100644 index 000000000..96d981570 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/download_file_example_call_tool.py @@ -0,0 +1,104 @@ +import base64 +import os + +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "{arcade_user_id}" +FILE_ID = "Projects/report.pdf" +OUTPUT_DIR = os.path.dirname(os.path.abspath(__file__)) + +# Authorize for download tools +auth_response = client.tools.authorize(tool_name="GoogleDrive.DownloadFile", user_id=USER_ID) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +# Step 1: Call download_file to get file info and possibly content +print(f"Downloading file: {FILE_ID}") +response = client.tools.execute( + tool_name="GoogleDrive.DownloadFile", + input={"file_path_or_id": FILE_ID}, + user_id=USER_ID, +) + +# Check for errors in the response +if response.output.error: + print(f"Error: {response.output.error}") + exit(1) + +result = response.output.value +if result is None: + print(f"Unexpected response: {response}") + exit(1) + +print(f"File name: {result['name']}") +print(f"MIME type: {result['mimeType']}") +print(f"Size: {result.get('size', 'unknown')} bytes") + +# Get file extension from the original filename +original_name = result["name"] +_, ext = os.path.splitext(original_name) +if not ext: + ext = ".bin" # Default extension if none found + +output_path = os.path.join(OUTPUT_DIR, f"downloaded_file{ext}") + +# Step 2: Check if chunked download is required +if result.get("requires_chunked_download"): + print("\nFile requires chunked download. Downloading in chunks...") + total_size = result["total_size_bytes"] + chunk_size = result["recommended_chunk_size"] + + # Collect all chunks + chunks = [] + start_byte = 0 + + while True: + print(f"Downloading chunk starting at byte {start_byte}...") + chunk_response = client.tools.execute( + tool_name="GoogleDrive.DownloadFileChunk", + input={ + "file_path_or_id": FILE_ID, + "start_byte": start_byte, + "chunk_size": chunk_size, + }, + user_id=USER_ID, + ) + + if chunk_response.output.error: + print(f"Error downloading chunk: {chunk_response.output.error}") + exit(1) + + chunk_result = chunk_response.output.value + if chunk_result is None: + print(f"Unexpected chunk response: {chunk_response}") + exit(1) + + chunk_content = base64.b64decode(chunk_result["content"]) + chunks.append(chunk_content) + + print(f"Progress: {chunk_result['progress_percent']}%") + + if chunk_result["is_final_chunk"]: + break + + start_byte = chunk_result["next_start_byte"] + + # Combine all chunks and save + file_content = b"".join(chunks) +else: + # Small file - content is included directly + print("\nFile content received directly (small file).") + file_content = base64.b64decode(result["content"]) + +# Save the file +with open(output_path, "wb") as f: + f.write(file_content) + +print(f"\nFile saved to: {output_path}") +print(f"Total bytes written: {len(file_content)}") diff --git a/public/examples/integrations/mcp-servers/google_drive/generate_google_file_picker_url_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/generate_google_file_picker_url_example_call_tool.py index 989623fae..e3863a966 100644 --- a/public/examples/integrations/mcp-servers/google_drive/generate_google_file_picker_url_example_call_tool.py +++ b/public/examples/integrations/mcp-servers/google_drive/generate_google_file_picker_url_example_call_tool.py @@ -14,9 +14,7 @@ # Wait for the authorization to complete client.auth.wait_for_completion(auth_response) -tool_input = { - -} +tool_input = {} response = client.tools.execute( tool_name=TOOL_NAME, diff --git a/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.js index 8958f7ef1..2e033d67d 100644 --- a/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.js +++ b/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.js @@ -17,11 +17,8 @@ await client.auth.waitForCompletion(authResponse); const toolInput = { "include_shared_drives": true, - "restrict_to_shared_drive_id": "abc123", - "order_by": [ - "name" - ], - "limit": 10 + "order_by": ["name"], + "limit": 100 }; const response = await client.tools.execute({ diff --git a/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.py index 1671a1f47..77a3015c2 100644 --- a/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.py +++ b/public/examples/integrations/mcp-servers/google_drive/get_file_tree_structure_example_call_tool.py @@ -15,10 +15,9 @@ client.auth.wait_for_completion(auth_response) tool_input = { - 'include_shared_drives': True, - 'restrict_to_shared_drive_id': 'abc123', - 'order_by': ['name'], - 'limit': 10 + "include_shared_drives": True, + "order_by": ["name"], + "limit": 100 } response = client.tools.execute( diff --git a/public/examples/integrations/mcp-servers/google_drive/move_file_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/move_file_example_call_tool.js new file mode 100644 index 000000000..e13c7e6b2 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/move_file_example_call_tool.js @@ -0,0 +1,31 @@ +import { Arcade } from "@arcadeai/arcadejs"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "{arcade_user_id}"; +const TOOL_NAME = "GoogleDrive.MoveFile"; + +// Start the authorization process +const authResponse = await client.tools.authorize({tool_name: TOOL_NAME, user_id: USER_ID}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +const toolInput = { + "source_file_path_or_id": "Downloads/report.pdf", + "destination_folder_path_or_id": "Projects/Archive", + "new_filename": "2024_report.pdf" +}; + +const response = await client.tools.execute({ + tool_name: TOOL_NAME, + input: toolInput, + user_id: USER_ID, +}); + +console.log(JSON.stringify(response.output.value, null, 2)); + diff --git a/public/examples/integrations/mcp-servers/google_drive/move_file_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/move_file_example_call_tool.py new file mode 100644 index 000000000..b571b02dc --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/move_file_example_call_tool.py @@ -0,0 +1,29 @@ +import json +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "{arcade_user_id}" +TOOL_NAME = "GoogleDrive.MoveFile" + +auth_response = client.tools.authorize(tool_name=TOOL_NAME, user_id=USER_ID) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +tool_input = { + "source_file_path_or_id": "Downloads/report.pdf", + "destination_folder_path_or_id": "Projects/Archive", + "new_filename": "2024_report.pdf" +} + +response = client.tools.execute( + tool_name=TOOL_NAME, + input=tool_input, + user_id=USER_ID, +) +print(json.dumps(response.output.value, indent=2)) + diff --git a/public/examples/integrations/mcp-servers/google_drive/rename_file_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/rename_file_example_call_tool.js new file mode 100644 index 000000000..7326de616 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/rename_file_example_call_tool.js @@ -0,0 +1,30 @@ +import { Arcade } from "@arcadeai/arcadejs"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "{arcade_user_id}"; +const TOOL_NAME = "GoogleDrive.RenameFile"; + +// Start the authorization process +const authResponse = await client.tools.authorize({tool_name: TOOL_NAME, user_id: USER_ID}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +const toolInput = { + "file_path_or_id": "Projects/old_report.pdf", + "new_filename": "Q4_Report_Final.pdf" +}; + +const response = await client.tools.execute({ + tool_name: TOOL_NAME, + input: toolInput, + user_id: USER_ID, +}); + +console.log(JSON.stringify(response.output.value, null, 2)); + diff --git a/public/examples/integrations/mcp-servers/google_drive/rename_file_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/rename_file_example_call_tool.py new file mode 100644 index 000000000..1d3bb77b0 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/rename_file_example_call_tool.py @@ -0,0 +1,28 @@ +import json +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "{arcade_user_id}" +TOOL_NAME = "GoogleDrive.RenameFile" + +auth_response = client.tools.authorize(tool_name=TOOL_NAME, user_id=USER_ID) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +tool_input = { + "file_path_or_id": "Projects/old_report.pdf", + "new_filename": "Q4_Report_Final.pdf" +} + +response = client.tools.execute( + tool_name=TOOL_NAME, + input=tool_input, + user_id=USER_ID, +) +print(json.dumps(response.output.value, indent=2)) + diff --git a/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.js index 8ae88a1d7..f1d934e4c 100644 --- a/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.js +++ b/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.js @@ -19,10 +19,7 @@ const toolInput = { "query": "project report", "include_shared_drives": true, "limit": 10, - "file_types": [ - "document", - "spreadsheet" - ] + "file_types": ["document", "spreadsheet"] }; const response = await client.tools.execute({ diff --git a/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.py index 3acc0f1cf..e94ed4a17 100644 --- a/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.py +++ b/public/examples/integrations/mcp-servers/google_drive/search_files_example_call_tool.py @@ -15,10 +15,10 @@ client.auth.wait_for_completion(auth_response) tool_input = { - 'query': 'project report', - 'include_shared_drives': True, - 'limit': 10, - 'file_types': ['document', 'spreadsheet'] + "query": "project report", + "include_shared_drives": True, + "limit": 10, + "file_types": ["document", "spreadsheet"] } response = client.tools.execute( diff --git a/public/examples/integrations/mcp-servers/google_drive/share_file_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/share_file_example_call_tool.js new file mode 100644 index 000000000..88849d30e --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/share_file_example_call_tool.js @@ -0,0 +1,33 @@ +import { Arcade } from "@arcadeai/arcadejs"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "{arcade_user_id}"; +const TOOL_NAME = "GoogleDrive.ShareFile"; + +// Start the authorization process +const authResponse = await client.tools.authorize({tool_name: TOOL_NAME, user_id: USER_ID}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +const toolInput = { + "file_path_or_id": "Projects/Q4_Report.pdf", + "email_addresses": ["colleague@example.com", "manager@example.com"], + "role": "writer", + "send_notification_email": true, + "message": "Please review the Q4 report" +}; + +const response = await client.tools.execute({ + tool_name: TOOL_NAME, + input: toolInput, + user_id: USER_ID, +}); + +console.log(JSON.stringify(response.output.value, null, 2)); + diff --git a/public/examples/integrations/mcp-servers/google_drive/share_file_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/share_file_example_call_tool.py new file mode 100644 index 000000000..3d2ce5d55 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/share_file_example_call_tool.py @@ -0,0 +1,31 @@ +import json +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "{arcade_user_id}" +TOOL_NAME = "GoogleDrive.ShareFile" + +auth_response = client.tools.authorize(tool_name=TOOL_NAME, user_id=USER_ID) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +tool_input = { + "file_path_or_id": "Projects/Q4_Report.pdf", + "email_addresses": ["colleague@example.com", "manager@example.com"], + "role": "writer", + "send_notification_email": True, + "message": "Please review the Q4 report" +} + +response = client.tools.execute( + tool_name=TOOL_NAME, + input=tool_input, + user_id=USER_ID, +) +print(json.dumps(response.output.value, indent=2)) + diff --git a/public/examples/integrations/mcp-servers/google_drive/upload_file_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/upload_file_example_call_tool.js new file mode 100644 index 000000000..9a456487f --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/upload_file_example_call_tool.js @@ -0,0 +1,31 @@ +import { Arcade } from "@arcadeai/arcadejs"; + +const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable + +const USER_ID = "{arcade_user_id}"; +const TOOL_NAME = "GoogleDrive.UploadFile"; + +// Start the authorization process +const authResponse = await client.tools.authorize({tool_name: TOOL_NAME, user_id: USER_ID}); + +if (authResponse.status !== "completed") { + console.log(`Click this link to authorize: ${authResponse.url}`); +} + +// Wait for the authorization to complete +await client.auth.waitForCompletion(authResponse); + +const toolInput = { + "file_name": "a_pretty_mountain.png", + "source_url": "https://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg", + "mime_type": "image/png", +}; + +const response = await client.tools.execute({ + tool_name: TOOL_NAME, + input: toolInput, + user_id: USER_ID, +}); + +console.log(JSON.stringify(response.output.value, null, 2)); + diff --git a/public/examples/integrations/mcp-servers/google_drive/upload_file_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/upload_file_example_call_tool.py new file mode 100644 index 000000000..c2d6e4429 --- /dev/null +++ b/public/examples/integrations/mcp-servers/google_drive/upload_file_example_call_tool.py @@ -0,0 +1,29 @@ +import json +from arcadepy import Arcade + +client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable + +USER_ID = "{arcade_user_id}" +TOOL_NAME = "GoogleDrive.UploadFile" + +auth_response = client.tools.authorize(tool_name=TOOL_NAME, user_id=USER_ID) + +if auth_response.status != "completed": + print(f"Click this link to authorize: {auth_response.url}") + +# Wait for the authorization to complete +client.auth.wait_for_completion(auth_response) + +tool_input = { + "file_name": "a_pretty_mountain.png", + "source_url": "https://upload.wikimedia.org/wikipedia/commons/3/3f/Fronalpstock_big.jpg", + "mime_type": "image/png", +} + +response = client.tools.execute( + tool_name=TOOL_NAME, + input=tool_input, + user_id=USER_ID, +) +print(json.dumps(response.output.value, indent=2)) + diff --git a/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.js b/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.js index 629196263..d3af7a823 100644 --- a/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.js +++ b/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.js @@ -6,7 +6,7 @@ const USER_ID = "{arcade_user_id}"; const TOOL_NAME = "GoogleDrive.WhoAmI"; // Start the authorization process -const authResponse = await client.tools.authorize({tool_name: TOOL_NAME}); +const authResponse = await client.tools.authorize({tool_name: TOOL_NAME, user_id: USER_ID}); if (authResponse.status !== "completed") { console.log(`Click this link to authorize: ${authResponse.url}`); diff --git a/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.py b/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.py index d81de1016..a7f0b5258 100644 --- a/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.py +++ b/public/examples/integrations/mcp-servers/google_drive/who_am_i_example_call_tool.py @@ -6,7 +6,7 @@ USER_ID = "{arcade_user_id}" TOOL_NAME = "GoogleDrive.WhoAmI" -auth_response = client.tools.authorize(tool_name=TOOL_NAME) +auth_response = client.tools.authorize(tool_name=TOOL_NAME, user_id=USER_ID) if auth_response.status != "completed": print(f"Click this link to authorize: {auth_response.url}") @@ -14,9 +14,7 @@ # Wait for the authorization to complete client.auth.wait_for_completion(auth_response) -tool_input = { - -} +tool_input = {} response = client.tools.execute( tool_name=TOOL_NAME,