Skip to content

Commit 35c7859

Browse files
jottakkaFrancisco Liberal
andauthored
Updating google docs docs! (#558)
* Updating google docs docs! * fixing broken link --------- Co-authored-by: Francisco Liberal <[email protected]>
1 parent 3d53a5d commit 35c7859

File tree

6 files changed

+200
-11
lines changed

6 files changed

+200
-11
lines changed

app/en/home/use-tools/tools-overview/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ To solve this, many AI models support tool calling (sometimes referred to as 'fu
1313

1414
Say a colleague shares a document with you on Google Drive, and you'd like an LLM to help you analyze it.
1515

16-
You could go to your Drive/Docs, open the document, copy its contents, and paste it into your chat. But what if the LLM could do this for you? The Arcade Google Docs MCP Server provides a [`SearchAndRetrieveDocuments`](/mcp-servers/productivity/google-docs#googledrivesearchandretrievedocuments) tool. By calling it, the LLM can find and read the document without you having to do anything.
16+
You could go to your Drive/Docs, open the document, copy its contents, and paste it into your chat. But what if the LLM could do this for you? The Arcade Google Docs MCP Server provides a [`SearchAndRetrieveDocuments`](/mcp-servers/productivity/google-docs#googledocssearchandretrievedocuments) tool. By calling it, the LLM can find and read the document without you having to do anything.
1717

1818
After analyzing the document, you decide that a meeting is needed with your colleague. You can ask the LLM to schedule a meeting and it will use the [Google Calendar MCP Server](/mcp-servers/productivity/google-calendar) to do it without you needing to leave the chat.
1919

app/en/mcp-servers/productivity/google-docs/page.mdx

Lines changed: 84 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import { Callout } from "nextra/components";
3030
The Arcade Google Docs MCP Server provides a pre-built set of tools for interacting with Google Docs. These tools make it easy to build agents and AI apps that can:
3131

3232
- Create, update, list, and delete documents
33+
- Access document metadata including hierarchical tab structures
34+
- Retrieve document content with full tab support in multiple formats (Markdown, HTML, DocMD)
3335

3436
## Available Tools
3537

@@ -47,6 +49,10 @@ These tools are currently available in the Arcade Google Docs MCP Sever.
4749
"GoogleDocs.GetDocumentAsDocMD",
4850
"Retrieve a Google Docs document by ID in DocMD format with metadata tags.",
4951
],
52+
[
53+
"GoogleDocs.GetDocumentMetadata",
54+
"Get metadata for a Google Docs document including hierarchical tab structure and approximate counts.",
55+
],
5056
[
5157
"GoogleDocs.EditDocument",
5258
"Edit a Google Docs document using natural language edit requests.",
@@ -98,10 +104,10 @@ These tools are currently available in the Arcade Google Docs MCP Sever.
98104
label: "Call the Tool with User Authorization",
99105
content: {
100106
Python: [
101-
"/examples/integrations/mcp-servers/google_docs/who_am_i_example_call_tool.py",
107+
"/examples/integrations/mcp-servers/google/docs/who_am_i_example_call_tool.py",
102108
],
103109
JavaScript: [
104-
"/examples/integrations/mcp-servers/google_docs/who_am_i_example_call_tool.js",
110+
"/examples/integrations/mcp-servers/google/docs/who_am_i_example_call_tool.js",
105111
],
106112
},
107113
},
@@ -152,21 +158,73 @@ Get the latest version of the specified Google Docs document.
152158
label: "Call the Tool with User Authorization",
153159
content: {
154160
Python: [
155-
"/examples/integrations/mcp-servers/google/docs/get_document_as_docmd_example_call_tool.py",
161+
"/examples/integrations/mcp-servers/google/docs/get_document_as_doc_md_example_call_tool.py",
156162
],
157163
JavaScript: [
158-
"/examples/integrations/mcp-servers/google/docs/get_document_as_docmd_example_call_tool.js",
164+
"/examples/integrations/mcp-servers/google/docs/get_document_as_doc_md_example_call_tool.js",
159165
],
160166
},
161167
},
162168
]}
163169
/>
164170

165-
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.
171+
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. If the document has tabs, all tabs are included in sequential order unless a specific `tab_id` is provided.
166172

167173
**Parameters**
168174

169175
- **`document_id`** _(string, required)_ The ID of the document to retrieve.
176+
- **`tab_id`** _(string, optional)_ The ID of a specific tab to retrieve. If provided, returns only content from that tab. If omitted, returns all tabs in sequential depth-first order.
177+
178+
---
179+
180+
## GoogleDocs.GetDocumentMetadata
181+
182+
<br />
183+
<TabbedCodeBlock
184+
tabs={[
185+
{
186+
label: "Call the Tool with User Authorization",
187+
content: {
188+
Python: [
189+
"/examples/integrations/mcp-servers/google/docs/get_document_metadata_example_call_tool.py",
190+
],
191+
JavaScript: [
192+
"/examples/integrations/mcp-servers/google/docs/get_document_metadata_example_call_tool.js",
193+
],
194+
},
195+
},
196+
]}
197+
/>
198+
199+
Get metadata for a Google Docs document including hierarchical tab structure. Returns document title, ID, URL, approximate total character and word counts, and nested tab information with approximate character and word counts for each tab.
200+
201+
**Parameters**
202+
203+
- **`document_id`** _(string, required)_ The ID of the document to get metadata for.
204+
205+
**Response Fields**
206+
207+
The response includes the following fields:
208+
209+
- **`documentId`** _(string)_ The unique identifier of the document.
210+
- **`title`** _(string)_ The title of the document.
211+
- **`documentUrl`** _(string)_ The URL to open and edit the document in Google Docs.
212+
- **`approximateTotalCharacterCount`** _(int)_ Approximate total number of characters across all tabs (or main body if no tabs).
213+
- **`approximateTotalWordCount`** _(int)_ Approximate total number of words across all tabs (or main body if no tabs).
214+
- **`tabsCount`** _(int)_ The total number of tabs in the document.
215+
- **`tabs`** _(list[dict])_ List of tabs with hierarchical structure. Each tab includes:
216+
- **`tabId`** _(string)_ The unique identifier of the tab.
217+
- **`title`** _(string)_ The title/name of the tab.
218+
- **`index`** _(int)_ The position of the tab among its siblings (0-indexed).
219+
- **`nestingLevel`** _(int)_ The nesting depth (0 for top-level, 1 for child, 2 for grandchild).
220+
- **`approximateCharacterCount`** _(int)_ Approximate number of characters in this tab's content (excluding child tabs).
221+
- **`approximateWordCount`** _(int)_ Approximate number of words in this tab's content (excluding child tabs).
222+
- **`parentTabId`** _(string, optional)_ The ID of the parent tab (if this is a nested tab).
223+
- **`childTabs`** _(list[dict], optional)_ List of nested child tabs within this tab.
224+
225+
<Callout type="info">
226+
**Note on Approximate Counts**: The character and word counts are approximate and may differ slightly from the exact counts shown in Google Docs. The counts are calculated by parsing the document structure and may not include all formatting or hidden content.
227+
</Callout>
170228

171229
---
172230

@@ -316,7 +374,7 @@ Search Google documents in the user's Google Drive. Excludes documents that are
316374
- **`limit`** _(int, optional)_ The number of documents to list. Defaults to `50`.
317375
- **`pagination_token`** _(str, optional)_ The pagination token to continue a previous request
318376

319-
## GoogleDrive.SearchAndRetrieveDocuments
377+
## GoogleDocs.SearchAndRetrieveDocuments
320378

321379
<br />
322380
<TabbedCodeBlock
@@ -335,11 +393,11 @@ Search Google documents in the user's Google Drive. Excludes documents that are
335393
]}
336394
/>
337395

338-
Searches for documents in the user's Google Drive and returns a list of documents (with text content) matching the search criteria. Excludes documents that are in the trash.
396+
Searches for documents in the user's Google Drive and returns a list of documents (with text content) matching the search criteria. Excludes documents that are in the trash. If the document has tabs, all tab content is included in the output.
339397

340398
**Parameters**
341399

342-
- **`document_format`** _(enum ([DocumentFormat](#documentformat)), optional)_ The format of the document to be returned. Defaults to Markdown.
400+
- **`return_format`** _(enum ([DocumentFormat](#documentformat)), optional)_ The format of the document to be returned. Defaults to Markdown. Can be `MARKDOWN`, `HTML`, `DOCMD`, or `GOOGLE_API_JSON`.
343401
- **`document_contains`** _(list[str], optional)_ Keywords or phrases that must be in the document title or body. Provide a list of keywords or phrases if needed.
344402
- **`document_not_contains`** _(list[str], optional)_ Keywords or phrases that must not be in the document title or body. Provide a list of keywords or phrases if needed.
345403
- **`search_only_in_shared_drive_id`** _(str, optional)_ The ID of the shared drive to restrict the search to. If provided, the search will only return documents from this drive. Defaults to None, which searches across all drives.
@@ -407,6 +465,21 @@ Comment on a specific document by its ID.
407465

408466
---
409467

468+
## Tab Support
469+
470+
Google Docs supports hierarchical tabs within documents. The Google Docs tools provide comprehensive support for working with tabs:
471+
472+
- **Tab Metadata**: `GetDocumentMetadata` returns hierarchical tab structures with approximate character and word counts for each tab
473+
- **Tab Content**: `GetDocumentAsDocMD` and `SearchAndRetrieveDocuments` include all tab content in their output
474+
- **Tab Filtering**: `GetDocumentAsDocMD` supports filtering to retrieve content from a specific tab using the `tab_id` parameter
475+
476+
Tabs are represented with the following structure:
477+
- Each tab has a unique `tabId`, `title`, `index`, and `nestingLevel`
478+
- Tabs can be nested up to 3 levels deep (parent → child → grandchild)
479+
- Tab metadata includes approximate character and word counts for each tab's content
480+
481+
---
482+
410483
## Auth
411484

412485
The Arcade Docs MCP Sever uses the [Google auth provider](/home/auth-providers/google) to connect to users' Google accounts.
@@ -423,8 +496,9 @@ With a self-hosted installation of Arcade, you need to [configure the Google aut
423496

424497
The format of the document to be returned.
425498

426-
- **`MARKDOWN`**: Markdown format.
427-
- **`HTML`**: HTML format.
499+
- **`MARKDOWN`**: Markdown format. Includes all tabs in the output if present.
500+
- **`HTML`**: HTML format. Includes all tabs in the output if present.
501+
- **`DOCMD`**: DocMD format with metadata tags. Includes all tabs in the output if present.
428502
- **`GOOGLE_API_JSON`**: Original JSON format returned by the Google API.
429503

430504
### OrderBy
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.GetDocumentMetadata";
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" // Document Ids can be found with the SearchDocuments tool
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);
32+
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.GetDocumentMetadata"
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" # Document Ids can be found with the SearchDocuments tool
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)
29+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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.WhoAmI";
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+
20+
const response = await client.tools.execute({
21+
tool_name: TOOL_NAME,
22+
input: toolInput,
23+
user_id: USER_ID,
24+
});
25+
26+
console.log(JSON.stringify(response.output.value, null, 2));
27+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import json
2+
from arcadepy import Arcade
3+
4+
client = Arcade() # Automatically finds the `ARCADE_API_KEY` env variable
5+
6+
USER_ID = "{arcade_user_id}"
7+
TOOL_NAME = "GoogleDocs.WhoAmI"
8+
9+
auth_response = client.tools.authorize(tool_name=TOOL_NAME)
10+
11+
if auth_response.status != "completed":
12+
print(f"Click this link to authorize: {auth_response.url}")
13+
14+
# Wait for the authorization to complete
15+
client.auth.wait_for_completion(auth_response)
16+
17+
tool_input = {
18+
19+
}
20+
21+
response = client.tools.execute(
22+
tool_name=TOOL_NAME,
23+
input=tool_input,
24+
user_id=USER_ID,
25+
)
26+
print(json.dumps(response.output.value, indent=2))
27+

0 commit comments

Comments
 (0)