Skip to content

Commit c3083e3

Browse files
authored
Google Drive search docs (#398)
* Google Drive search docs * remove dupe page * delete old examples * fix links
1 parent 0c53368 commit c3083e3

File tree

8 files changed

+187
-95
lines changed

8 files changed

+187
-95
lines changed
Lines changed: 56 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Google Drive
1+
# GoogleDrive
22

33
import ToolInfo from "@/components/ToolInfo";
44
import Badges from "@/components/Badges";
@@ -7,39 +7,37 @@ import TableOfContents from "@/components/TableOfContents";
77
import ToolFooter from "@/components/ToolFooter";
88

99
<ToolInfo
10-
description="Enable agents to interact with Google Drive."
10+
description="Enable agents to interact with GoogleDrive"
1111
author="Arcade"
12-
codeLink="https://github.com/ArcadeAI/arcade-ai/tree/main/toolkits/google_drive"
13-
authType="oauth2"
14-
authProviderName="Google"
15-
versions={["0.1.0"]}
12+
authType="OAuth2"
13+
versions={["3.0.0"]}
1614
/>
1715

18-
1916
<Badges repo="arcadeai/arcade_google_drive" />
2017

21-
The Arcade Google Drive toolkit provides a pre-built set of tools for interacting with Google Drive. These tools make it easy to build agents and AI apps that can:
18+
The GoogleDrive toolkit provides a set of tools for interacting with Google Drive, enabling users to efficiently manage and access their files. With this toolkit, users can:
2219

23-
- Search Google documents in the user's Google Drive
24-
- Search and retrieve the contents of Google documents in the user's Google Drive
20+
- Retrieve the file and folder structure of their Google Drive.
21+
- Generate a Google File Picker URL for user-driven file selection and authorization, allowing secure access to files.
22+
- Search for specific files within Google Drive.
2523

2624
## Available Tools
2725

28-
These tools are currently available in the Arcade Google Drive toolkit.
29-
3026
<TableOfContents
3127
headers={["Tool Name", "Description"]}
32-
data={[
33-
["GoogleDrive.GetFileTreeStructure", "Get the file/folder tree structure of the user's Google Drive."],
34-
["GoogleDrive.GenerateGoogleFilePickerUrl", "Generate a Google File Picker URL for user-driven file selection and authorization"],
35-
]}
28+
data={
29+
[
30+
["GoogleDrive.GetFileTreeStructure", "Get the file/folder tree structure of the user's Google Drive."],
31+
["GoogleDrive.GenerateGoogleFilePickerUrl", "Generate a Google File Picker URL for user-driven file selection and authorization."],
32+
["GoogleDrive.SearchFiles", "Search for files in Google Drive"],
33+
]
34+
}
3635
/>
3736

3837
<Tip>
3938
If you need to perform an action that's not listed here, you can [get in touch
4039
with us](mailto:[email protected]) to request a new tool, or [create your
41-
own tools](/home/build-tools/create-a-toolkit) with the [Google auth
42-
provider](/home/auth-providers/google#using-google-auth-in-custom-tools).
40+
own tools](/home/build-tools/create-a-toolkit).
4341
</Tip>
4442

4543
## GoogleDrive.GetFileTreeStructure
@@ -50,24 +48,23 @@ These tools are currently available in the Arcade Google Drive toolkit.
5048
{
5149
label: "Call the Tool with User Authorization",
5250
content: {
53-
Python: [
54-
"/examples/integrations/toolkits/google/drive/get_file_tree_structure_example_call_tool.py",
55-
],
56-
JavaScript: ["/examples/integrations/toolkits/google/drive/get_file_tree_structure_example_call_tool.js"],
51+
Python: ["/examples/integrations/toolkits/google_drive/get_file_tree_structure_example_call_tool.py"],
52+
JavaScript: ["/examples/integrations/toolkits/google_drive/get_file_tree_structure_example_call_tool.js"],
5753
},
58-
}
54+
},
5955
]}
6056
/>
6157

6258
Get the file/folder tree structure of the user's Google Drive.
6359

6460
**Parameters**
6561

66-
- **`include_shared_drives`** _(bool, optional)_ Whether to include shared drives in the file tree structure. Defaults to False.
67-
- **`restrict_to_shared_drive_id`** _(str, 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.
68-
- **`include_organization_domain_documents`** _(bool, 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.
69-
- **`order_by`** _(enum ([OrderBy](#orderby)), optional)_ Sort order. Defaults to listing the most recently modified documents first.
70-
- **`limit`** _(int, optional)_ The number of files and folders to list. Defaults to None, which will list all files and folders.
62+
- **include_shared_drives** (`boolean`, optional) Whether to include shared drives in the file tree structure. Defaults to False.
63+
- **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.
64+
- **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.
65+
- **order_by** (`Enum` [OrderBy](/toolkits/productivity/google_drive/reference#OrderBy), optional) Sort order. Defaults to listing the most recently modified documents first
66+
- **limit** (`integer`, optional) The number of files and folders to list. Defaults to None, which will list all files and folders.
67+
7168

7269
## GoogleDrive.GenerateGoogleFilePickerUrl
7370

@@ -77,63 +74,52 @@ Get the file/folder tree structure of the user's Google Drive.
7774
{
7875
label: "Call the Tool with User Authorization",
7976
content: {
80-
Python: [
81-
"/examples/integrations/toolkits/google/drive/generate_google_file_picker_url_example_call_tool.py",
82-
],
83-
JavaScript: ["/examples/integrations/toolkits/google/drive/generate_google_file_picker_url_example_call_tool.js"],
77+
Python: ["/examples/integrations/toolkits/google_drive/generate_google_file_picker_url_example_call_tool.py"],
78+
JavaScript: ["/examples/integrations/toolkits/google_drive/generate_google_file_picker_url_example_call_tool.js"],
8479
},
85-
}
80+
},
8681
]}
8782
/>
8883

8984
Generate a Google File Picker URL for user-driven file selection and authorization.
9085

91-
This tool generates a URL that directs the end-user to a Google File Picker interface where
92-
where they can select or upload Google Drive files. Users can grant permission to access their
93-
Drive files, providing a secure and authorized way to interact with their files.
86+
**Parameters**
9487

95-
This is particularly useful when prior tools (e.g., those accessing or modifying
96-
Google Docs, Google Sheets, etc.) encountered failures due to file non-existence
97-
(Requested entity was not found) or permission errors. Once the user completes the file
98-
picker flow, the prior tool can be retried.
88+
This tool does not take any parameters.
9989

100-
## Auth
90+
## GoogleDrive.SearchFiles
10191

102-
The Arcade Google Drive toolkit uses the [Google auth provider](/home/auth-providers/google) to connect to users' Google accounts.
92+
<br />
93+
<TabbedCodeBlock
94+
tabs={[
95+
{
96+
label: "Call the Tool with User Authorization",
97+
content: {
98+
Python: ["/examples/integrations/toolkits/google_drive/search_files_example_call_tool.py"],
99+
JavaScript: ["/examples/integrations/toolkits/google_drive/search_files_example_call_tool.js"],
100+
},
101+
},
102+
]}
103+
/>
103104

104-
With the hosted Arcade Engine, there's nothing to configure. Your users will see `Arcade` as the name of the application that's requesting permission.
105+
Search for files in Google Drive
105106

106-
With a self-hosted installation of Arcade, you need to [configure the Google auth provider](/home/auth-providers/google#configuring-google-auth) with your own Google app credentials.
107+
**Parameters**
108+
109+
- **query** (`string`, required) The search query to use to find files in Google DriveThis can include document titles or body content.
110+
- **include_shared_drives** (`boolean`, optional) Whether to include shared drives in the search. Defaults to False.
111+
- **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.
112+
- **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.
113+
- **order_by** (`Enum` [OrderBy](/toolkits/productivity/google_drive/reference#OrderBy), optional) Sort order for search results. Defaults to listing the most recently modified documents first
114+
- **limit** (`integer`, optional) The maximum number of search results to return. Defaults to 50.
115+
- **file_types** (`Enum` [GoogleDriveFileType](/toolkits/productivity/google_drive/reference#GoogleDriveFileType), optional) Filter by specific file types. Defaults to None, which includes all file types.
107116

108-
---
109117

110-
## Reference
111118

112-
## OrderBy
113119

114-
Sort keys for ordering files in Google Drive. Each key has both ascending and descending options.
120+
## Auth
115121

116-
- **`CREATED_TIME`**: When the file was created (ascending).
117-
- **`CREATED_TIME_DESC`**: When the file was created (descending).
118-
- **`FOLDER`**: The folder ID, sorted using alphabetical ordering (ascending).
119-
- **`FOLDER_DESC`**: The folder ID, sorted using alphabetical ordering (descending).
120-
- **`MODIFIED_BY_ME_TIME`**: The last time the file was modified by the user (ascending).
121-
- **`MODIFIED_BY_ME_TIME_DESC`**: The last time the file was modified by the user (descending).
122-
- **`MODIFIED_TIME`**: The last time the file was modified by anyone (ascending).
123-
- **`MODIFIED_TIME_DESC`**: The last time the file was modified by anyone (descending).
124-
- **`NAME`**: The name of the file, sorted using alphabetical ordering (ascending).
125-
- **`NAME_DESC`**: The name of the file, sorted using alphabetical ordering (descending).
126-
- **`NAME_NATURAL`**: The name of the file, sorted using natural sort ordering (ascending).
127-
- **`NAME_NATURAL_DESC`**: The name of the file, sorted using natural sort ordering (descending).
128-
- **`QUOTA_BYTES_USED`**: The number of storage quota bytes used by the file (ascending).
129-
- **`QUOTA_BYTES_USED_DESC`**: The number of storage quota bytes used by the file (descending).
130-
- **`RECENCY`**: The most recent timestamp from the file's date-time fields (ascending).
131-
- **`RECENCY_DESC`**: The most recent timestamp from the file's date-time fields (descending).
132-
- **`SHARED_WITH_ME_TIME`**: When the file was shared with the user, if applicable (ascending).
133-
- **`SHARED_WITH_ME_TIME_DESC`**: When the file was shared with the user, if applicable (descending).
134-
- **`STARRED`**: Whether the user has starred the file (ascending).
135-
- **`STARRED_DESC`**: Whether the user has starred the file (descending).
136-
- **`VIEWED_BY_ME_TIME`**: The last time the file was viewed by the user (ascending).
137-
- **`VIEWED_BY_ME_TIME_DESC`**: The last time the file was viewed by the user (descending).
122+
The Arcade GoogleDrive toolkit 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.
138123

139124
<ToolFooter pipPackageName="arcade_google_drive" />
125+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# GoogleDrive Reference
2+
3+
Below is a reference of enumerations used by some tools in the GoogleDrive toolkit:
4+
5+
## OrderBy
6+
7+
- **CREATED_TIME**: `createdTime`
8+
- **CREATED_TIME_DESC**: `createdTime desc`
9+
- **FOLDER**: `folder`
10+
- **FOLDER_DESC**: `folder desc`
11+
- **MODIFIED_BY_ME_TIME**: `modifiedByMeTime`
12+
- **MODIFIED_BY_ME_TIME_DESC**: `modifiedByMeTime desc`
13+
- **MODIFIED_TIME**: `modifiedTime`
14+
- **MODIFIED_TIME_DESC**: `modifiedTime desc`
15+
- **NAME**: `name`
16+
- **NAME_DESC**: `name desc`
17+
- **NAME_NATURAL**: `name_natural`
18+
- **NAME_NATURAL_DESC**: `name_natural desc`
19+
- **QUOTA_BYTES_USED**: `quotaBytesUsed`
20+
- **QUOTA_BYTES_USED_DESC**: `quotaBytesUsed desc`
21+
- **RECENCY**: `recency`
22+
- **RECENCY_DESC**: `recency desc`
23+
- **SHARED_WITH_ME_TIME**: `sharedWithMeTime`
24+
- **SHARED_WITH_ME_TIME_DESC**: `sharedWithMeTime desc`
25+
- **STARRED**: `starred`
26+
- **STARRED_DESC**: `starred desc`
27+
- **VIEWED_BY_ME_TIME**: `viewedByMeTime`
28+
- **VIEWED_BY_ME_TIME_DESC**: `viewedByMeTime desc`
29+
30+
## GoogleDriveFileType
31+
32+
- **SPREADSHEET**: `spreadsheet`
33+
- **SLIDES**: `slides`
34+
- **DOCUMENT**: `document`
35+
- **DRAWING**: `drawing`
36+
- **FORM**: `form`
37+
- **FOLDER**: `folder`
38+
- **IMAGE**: `image`
39+
- **VIDEO**: `video`
40+
- **AUDIO**: `audio`
41+
- **SCRIPT**: `script`
42+
- **SITES**: `sites`
43+
- **PDF**: `pdf`
44+
45+

public/examples/integrations/toolkits/google/drive/generate_google_file_picker_url_example_call_tool.js renamed to public/examples/integrations/toolkits/google_drive/generate_google_file_picker_url_example_call_tool.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ const USER_ID = "{arcade_user_id}";
66
const TOOL_NAME = "GoogleDrive.GenerateGoogleFilePickerUrl";
77

88
// Start the authorization process
9-
const authResponse = await client.tools.authorize({
10-
tool_name: TOOL_NAME,
11-
user_id: USER_ID,
12-
});
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
1310

1411
if (authResponse.status !== "completed") {
1512
console.log(`Click this link to authorize: ${authResponse.url}`);
@@ -26,4 +23,4 @@ const response = await client.tools.execute({
2623
user_id: USER_ID,
2724
});
2825

29-
console.log(response);
26+
console.log(JSON.stringify(response.output.value, null, 2));

public/examples/integrations/toolkits/google/drive/generate_google_file_picker_url_example_call_tool.py renamed to public/examples/integrations/toolkits/google_drive/generate_google_file_picker_url_example_call_tool.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1+
import json
12
from arcadepy import Arcade
23

34
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
45

56
USER_ID = "{arcade_user_id}"
67
TOOL_NAME = "GoogleDrive.GenerateGoogleFilePickerUrl"
78

8-
auth_response = client.tools.authorize(
9-
tool_name=TOOL_NAME,
10-
user_id=USER_ID,
11-
)
9+
auth_response = client.tools.authorize(tool_name=TOOL_NAME)
1210

1311
if auth_response.status != "completed":
1412
print(f"Click this link to authorize: {auth_response.url}")
1513

1614
# Wait for the authorization to complete
1715
client.auth.wait_for_completion(auth_response)
1816

19-
tool_input = {}
17+
tool_input = {
18+
19+
}
2020

2121
response = client.tools.execute(
2222
tool_name=TOOL_NAME,
2323
input=tool_input,
2424
user_id=USER_ID,
2525
)
26-
print(response)
26+
print(json.dumps(response.output.value, indent=2))

public/examples/integrations/toolkits/google/drive/get_file_tree_structure_example_call_tool.js renamed to public/examples/integrations/toolkits/google_drive/get_file_tree_structure_example_call_tool.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ const USER_ID = "{arcade_user_id}";
66
const TOOL_NAME = "GoogleDrive.GetFileTreeStructure";
77

88
// Start the authorization process
9-
const authResponse = await client.tools.authorize({
10-
tool_name: TOOL_NAME,
11-
user_id: USER_ID,
12-
});
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
1310

1411
if (authResponse.status !== "completed") {
1512
console.log(`Click this link to authorize: ${authResponse.url}`);
@@ -19,8 +16,12 @@ if (authResponse.status !== "completed") {
1916
await client.auth.waitForCompletion(authResponse);
2017

2118
const toolInput = {
22-
include_shared_drives: true,
23-
limit: 10,
19+
"include_shared_drives": true,
20+
"restrict_to_shared_drive_id": "abc123",
21+
"order_by": [
22+
"name"
23+
],
24+
"limit": 10
2425
};
2526

2627
const response = await client.tools.execute({
@@ -29,4 +30,4 @@ const response = await client.tools.execute({
2930
user_id: USER_ID,
3031
});
3132

32-
console.log(response);
33+
console.log(JSON.stringify(response.output.value, null, 2));

public/examples/integrations/toolkits/google/drive/get_file_tree_structure_example_call_tool.py renamed to public/examples/integrations/toolkits/google_drive/get_file_tree_structure_example_call_tool.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1+
import json
12
from arcadepy import Arcade
23

34
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
45

56
USER_ID = "{arcade_user_id}"
67
TOOL_NAME = "GoogleDrive.GetFileTreeStructure"
78

8-
auth_response = client.tools.authorize(
9-
tool_name=TOOL_NAME,
10-
user_id=USER_ID,
11-
)
9+
auth_response = client.tools.authorize(tool_name=TOOL_NAME)
1210

1311
if auth_response.status != "completed":
1412
print(f"Click this link to authorize: {auth_response.url}")
@@ -17,13 +15,15 @@
1715
client.auth.wait_for_completion(auth_response)
1816

1917
tool_input = {
20-
"include_shared_drives": True,
21-
"limit": 10,
18+
'include_shared_drives': True,
19+
'restrict_to_shared_drive_id': 'abc123',
20+
'order_by': ['name'],
21+
'limit': 10
2222
}
2323

2424
response = client.tools.execute(
2525
tool_name=TOOL_NAME,
2626
input=tool_input,
2727
user_id=USER_ID,
2828
)
29-
print(response)
29+
print(json.dumps(response.output.value, indent=2))
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Arcade } from "@arcadeai/arcadejs";
2+
3+
const client = new Arcade(); // Automatically finds the `ARCADE_API_KEY` env variable
4+
5+
const USER_ID = "{arcade_user_id}";
6+
const TOOL_NAME = "GoogleDrive.SearchFiles";
7+
8+
// Start the authorization process
9+
const authResponse = await client.tools.authorize({tool_name: TOOL_NAME});
10+
11+
if (authResponse.status !== "completed") {
12+
console.log(`Click this link to authorize: ${authResponse.url}`);
13+
}
14+
15+
// Wait for the authorization to complete
16+
await client.auth.waitForCompletion(authResponse);
17+
18+
const toolInput = {
19+
"query": "project report",
20+
"include_shared_drives": true,
21+
"limit": 10,
22+
"file_types": [
23+
"document",
24+
"spreadsheet"
25+
]
26+
};
27+
28+
const response = await client.tools.execute({
29+
tool_name: TOOL_NAME,
30+
input: toolInput,
31+
user_id: USER_ID,
32+
});
33+
34+
console.log(JSON.stringify(response.output.value, null, 2));

0 commit comments

Comments
 (0)