Skip to content

Commit 9e54d18

Browse files
committed
Add GoogleDocs tools
1 parent 031a3d9 commit 9e54d18

5 files changed

Lines changed: 172 additions & 0 deletions

File tree

pages/toolkits/productivity/google_docs.mdx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ These tools are currently available in the Arcade Google Docs toolkit.
3838
["GoogleDocs.CreateDocumentFromText", "Create a new Google Docs document with specified text content. Note: This tool currently requires a self-hosted instance of Arcade.", ],
3939
["GoogleDocs.SearchDocuments", "Search for documents in the user's Google Drive. Note: This tool currently requires a self-hosted instance of Arcade."],
4040
["GoogleDocs.SearchAndRetrieveDocuments", "Search and retrieve the contents of Google documents in the user's Google Drive. Note: This tool currently requires a self-hosted instance of Arcade."],
41+
["GoogleDocs.ListDocumentComments", "List all comments on the specified Google Docs document. Note: This tool currently requires a self-hosted instance of Arcade.", ],
42+
["GoogleDocs.CommentOnDocument", "Comment on a specific document by its ID. Note: This tool currently requires a self-hosted instance of Arcade.", ],
4143
]}
4244
/>
4345

@@ -211,6 +213,60 @@ Searches for documents in the user's Google Drive and returns a list of document
211213
- **`limit`** _(int, optional)_ The number of documents to list. Defaults to `50`.
212214
- **`pagination_token`** _(str, optional)_ The pagination token to continue a previous request
213215

216+
---
217+
218+
## GoogleDocs.ListDocumentComments
219+
220+
<br />
221+
<TabbedCodeBlock
222+
tabs={[
223+
{
224+
label: "Call the Tool with User Authorization",
225+
content: {
226+
Python: [
227+
"/examples/integrations/toolkits/google/docs/list_document_comments.py",
228+
],
229+
JavaScript: ["/examples/integrations/toolkits/google/docs/list_document_comments.js"],
230+
},
231+
}
232+
]}
233+
/>
234+
235+
List all comments on the specified Google Docs document.
236+
237+
**Parameters**
238+
239+
- **`document_id`** _(string, required)_ The ID of the document to list comments for.
240+
- **`include_deleted`** _(bool, optional)_ Whether to include deleted comments in the results. Defaults to False.
241+
242+
---
243+
244+
## GoogleDocs.CommentOnDocument
245+
246+
<br />
247+
<TabbedCodeBlock
248+
tabs={[
249+
{
250+
label: "Call the Tool with User Authorization",
251+
content: {
252+
Python: [
253+
"/examples/integrations/toolkits/google/docs/comment_on_document.py",
254+
],
255+
JavaScript: ["/examples/integrations/toolkits/google/docs/comment_on_document.js"],
256+
},
257+
}
258+
]}
259+
/>
260+
261+
Comment on a specific document by its ID.
262+
263+
**Parameters**
264+
265+
- **`document_id`** _(string, required)_ The ID of the document to comment on.
266+
- **`comment_text`** _(string, required)_ The comment to add to the document.
267+
268+
269+
---
214270
## Auth
215271

216272
The Arcade Docs toolkit uses the [Google auth provider](/home/auth-providers/google) to connect to users' Google accounts.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 = "GoogleDocs.CommentOnDocument";
7+
8+
// Start the authorization process
9+
const authResponse = await client.tools.authorize({
10+
tool_name: TOOL_NAME,
11+
user_id: USER_ID,
12+
});
13+
14+
if (authResponse.status !== "completed") {
15+
console.log(`Click this link to authorize: ${authResponse.url}`);
16+
}
17+
18+
// Wait for the authorization to complete
19+
await client.auth.waitForCompletion(authResponse);
20+
21+
const toolInput = {
22+
document_id: "your_document_id_here",
23+
comment_text: "This is a comment"
24+
};
25+
26+
const response = await client.tools.execute({
27+
tool_name: TOOL_NAME,
28+
input: toolInput,
29+
user_id: USER_ID,
30+
});
31+
32+
console.log(response);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from arcadepy import Arcade
2+
3+
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
4+
5+
USER_ID = "{arcade_user_id}"
6+
TOOL_NAME = "GoogleDocs.CommentOnDocument"
7+
8+
auth_response = client.tools.authorize(
9+
tool_name=TOOL_NAME,
10+
user_id=USER_ID,
11+
)
12+
13+
if auth_response.status != "completed":
14+
print(f"Click this link to authorize: {auth_response.url}")
15+
16+
# Wait for the authorization to complete
17+
client.auth.wait_for_completion(auth_response)
18+
19+
tool_input = {"document_id": "your_document_id_here", "comment_text": "This is a comment"}
20+
21+
response = client.tools.execute(
22+
tool_name=TOOL_NAME,
23+
input=tool_input,
24+
user_id=USER_ID,
25+
)
26+
print(response)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 = "GoogleDocs.ListDocumentComments";
7+
8+
// Start the authorization process
9+
const authResponse = await client.tools.authorize({
10+
tool_name: TOOL_NAME,
11+
user_id: USER_ID,
12+
});
13+
14+
if (authResponse.status !== "completed") {
15+
console.log(`Click this link to authorize: ${authResponse.url}`);
16+
}
17+
18+
// Wait for the authorization to complete
19+
await client.auth.waitForCompletion(authResponse);
20+
21+
const toolInput = {
22+
document_id: "your_document_id_here",
23+
include_deleted: false
24+
};
25+
26+
const response = await client.tools.execute({
27+
tool_name: TOOL_NAME,
28+
input: toolInput,
29+
user_id: USER_ID,
30+
});
31+
32+
console.log(response);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from arcadepy import Arcade
2+
3+
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
4+
5+
USER_ID = "{arcade_user_id}"
6+
TOOL_NAME = "GoogleDocs.ListDocumentComments"
7+
8+
auth_response = client.tools.authorize(
9+
tool_name=TOOL_NAME,
10+
user_id=USER_ID,
11+
)
12+
13+
if auth_response.status != "completed":
14+
print(f"Click this link to authorize: {auth_response.url}")
15+
16+
# Wait for the authorization to complete
17+
client.auth.wait_for_completion(auth_response)
18+
19+
tool_input = {"document_id": "your_document_id_here", "include_deleted": False}
20+
21+
response = client.tools.execute(
22+
tool_name=TOOL_NAME,
23+
input=tool_input,
24+
user_id=USER_ID,
25+
)
26+
print(response)

0 commit comments

Comments
 (0)