Skip to content

Commit eaa9e2f

Browse files
Docs: Add GoogleDocs updates (#427)
* Add GoogleDocs updates * Update pages/toolkits/productivity/google_docs.mdx Co-authored-by: Evan Tahler <[email protected]> --------- Co-authored-by: Evan Tahler <[email protected]>
1 parent 28a4259 commit eaa9e2f

File tree

5 files changed

+194
-8
lines changed

5 files changed

+194
-8
lines changed

pages/toolkits/productivity/google_docs.mdx

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ These tools are currently available in the Arcade Google Docs toolkit.
3232
<TableOfContents
3333
headers={["Tool Name", "Description"]}
3434
data={[
35-
["GoogleDocs.GetDocumentById", "Retrieve a Google Docs document by ID. Note: This tool currently requires a self-hosted instance of Arcade.", ],
36-
["GoogleDocs.InsertTextAtEndOfDocument", "Insert text at the end of a Google Docs document. Note: This tool currently requires a self-hosted instance of Arcade.", ],
37-
["GoogleDocs.CreateBlankDocument", "Create a new blank Google Docs document with a title. Note: This tool currently requires a self-hosted instance of Arcade.", ],
38-
["GoogleDocs.CreateDocumentFromText", "Create a new Google Docs document with specified text content. Note: This tool currently requires a self-hosted instance of Arcade.", ],
39-
["GoogleDocs.SearchDocuments", "Search for documents in the user's Google Drive. Note: This tool currently requires a self-hosted instance of Arcade."],
40-
["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.", ],
35+
["GoogleDocs.GetDocumentById", "Retrieve a Google Docs document by ID.", ],
36+
["GoogleDocs.GetDocumentAsDocMD", "Retrieve a Google Docs document by ID in DocMD format with metadata tags.", ],
37+
["GoogleDocs.EditDocument", "Edit a Google Docs document using natural language edit requests.", ],
38+
["GoogleDocs.InsertTextAtEndOfDocument", "Insert text at the end of a Google Docs document.", ],
39+
["GoogleDocs.CreateBlankDocument", "Create a new blank Google Docs document with a title.", ],
40+
["GoogleDocs.CreateDocumentFromText", "Create a new Google Docs document with specified text content.", ],
41+
["GoogleDocs.SearchDocuments", "Search for documents in the user's Google Drive."],
42+
["GoogleDocs.SearchAndRetrieveDocuments", "Search and retrieve the contents of Google documents in the user's Google Drive."],
43+
["GoogleDocs.ListDocumentComments", "List all comments on the specified Google Docs document.", ],
44+
["GoogleDocs.CommentOnDocument", "Comment on a specific document by its ID.", ],
4345
]}
4446
/>
4547

@@ -75,6 +77,60 @@ Get the latest version of the specified Google Docs document.
7577

7678
---
7779

80+
## GoogleDocs.GetDocumentAsDocMD
81+
82+
<br />
83+
<TabbedCodeBlock
84+
tabs={[
85+
{
86+
label: "Call the Tool with User Authorization",
87+
content: {
88+
Python: [
89+
"/examples/integrations/toolkits/google/docs/get_document_as_docmd_example_call_tool.py",
90+
],
91+
JavaScript: ["/examples/integrations/toolkits/google/docs/get_document_as_docmd_example_call_tool.js"],
92+
},
93+
}
94+
]}
95+
/>
96+
97+
Get the latest version of the specified Google Docs document in DocMD format. The DocMD output includes tags that can be used to annotate the document with location information, block types, block IDs, and other metadata.
98+
99+
**Parameters**
100+
101+
- **`document_id`** _(string, required)_ The ID of the document to retrieve.
102+
103+
---
104+
105+
## GoogleDocs.EditDocument
106+
107+
<br />
108+
<TabbedCodeBlock
109+
tabs={[
110+
{
111+
label: "Call the Tool with User Authorization",
112+
content: {
113+
Python: [
114+
"/examples/integrations/toolkits/google/docs/edit_document_example_call_tool.py",
115+
],
116+
JavaScript: ["/examples/integrations/toolkits/google/docs/edit_document_example_call_tool.js"],
117+
},
118+
}
119+
]}
120+
/>
121+
122+
Edit a Google Docs document using natural language edit requests. This tool is stateless and does not have context about previous edits. If your edit request depends on knowledge about previous edits, provide that context in the edit requests.
123+
124+
Note that this tool is agentic, and requires the secret OPENAI_API_KEY to be set.
125+
126+
**Parameters**
127+
128+
- **`document_id`** _(string, required)_ The ID of the document to edit.
129+
- **`edit_requests`** _(list[str], required)_ A list of natural language descriptions of the desired changes to the document. Each entry should be a single, self-contained edit request that can be fully understood independently. Note: Each request may result in zero, one, or multiple actual edits depending on what changes are needed (e.g., a request might be ignored if the change already exists in the document).
130+
- **`reasoning_effort`** _(enum ([ReasoningEffort](#reasoningeffort)), optional)_ The effort to put into reasoning about the edits. Defaults to medium.
131+
132+
---
133+
78134
## GoogleDocs.InsertTextAtEndOfDocument
79135

80136
<br />
@@ -314,4 +370,13 @@ Sort keys for ordering files in Google Drive. Each key has both ascending and de
314370
- **`VIEWED_BY_ME_TIME`**: The last time the file was viewed by the user (ascending).
315371
- **`VIEWED_BY_ME_TIME_DESC`**: The last time the file was viewed by the user (descending).
316372

373+
### ReasoningEffort
374+
375+
The effort to put into reasoning about document edits.
376+
377+
- **`MINIMAL`**: Minimal reasoning effort for simple, straightforward edits.
378+
- **`LOW`**: Minimal reasoning effort for simple, straightforward edits.
379+
- **`MEDIUM`**: Moderate reasoning effort for most editing tasks (default).
380+
- **`HIGH`**: Maximum reasoning effort for complex edits requiring careful analysis.
381+
317382
<ToolFooter pipPackageName="arcade_google_docs" />
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.EditDocument";
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+
edit_requests: ["Replace all occurances of 'lightning' with 'thunder'"],
24+
reasoning_effort: "LOW",
25+
};
26+
27+
const response = await client.tools.execute({
28+
tool_name: TOOL_NAME,
29+
input: toolInput,
30+
user_id: USER_ID,
31+
});
32+
33+
console.log(response);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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.EditDocument"
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 = {
20+
"document_id": "your_document_id_here",
21+
"edit_requests": ["Replace all occurances of 'lightning' with 'thunder'"], "reasoning_effort": "LOW"
22+
}
23+
24+
response = client.tools.execute(
25+
tool_name=TOOL_NAME,
26+
input=tool_input,
27+
user_id=USER_ID,
28+
)
29+
print(response)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.GetDocumentAsDocMD";
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+
};
24+
25+
const response = await client.tools.execute({
26+
tool_name: TOOL_NAME,
27+
input: toolInput,
28+
user_id: USER_ID,
29+
});
30+
31+
console.log(response);
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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.GetDocumentAsDocMD"
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 = {
20+
"document_id": "your_document_id_here",
21+
}
22+
23+
response = client.tools.execute(
24+
tool_name=TOOL_NAME,
25+
input=tool_input,
26+
user_id=USER_ID,
27+
)
28+
print(response)

0 commit comments

Comments
 (0)