universal-mcp-applications 0.1.30__py3-none-any.whl → 0.1.36rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of universal-mcp-applications might be problematic. Click here for more details.
- universal_mcp/applications/ahrefs/app.py +52 -198
- universal_mcp/applications/airtable/app.py +23 -122
- universal_mcp/applications/apollo/app.py +111 -464
- universal_mcp/applications/asana/app.py +417 -1567
- universal_mcp/applications/aws_s3/app.py +33 -100
- universal_mcp/applications/bill/app.py +546 -1957
- universal_mcp/applications/box/app.py +1068 -3981
- universal_mcp/applications/braze/app.py +364 -1430
- universal_mcp/applications/browser_use/app.py +2 -8
- universal_mcp/applications/cal_com_v2/app.py +207 -625
- universal_mcp/applications/calendly/app.py +61 -200
- universal_mcp/applications/canva/app.py +45 -110
- universal_mcp/applications/clickup/app.py +207 -674
- universal_mcp/applications/coda/app.py +146 -426
- universal_mcp/applications/confluence/app.py +310 -1098
- universal_mcp/applications/contentful/app.py +36 -151
- universal_mcp/applications/crustdata/app.py +28 -107
- universal_mcp/applications/dialpad/app.py +283 -756
- universal_mcp/applications/digitalocean/app.py +1766 -5777
- universal_mcp/applications/domain_checker/app.py +3 -54
- universal_mcp/applications/e2b/app.py +14 -64
- universal_mcp/applications/elevenlabs/app.py +9 -47
- universal_mcp/applications/exa/app.py +6 -17
- universal_mcp/applications/falai/app.py +23 -100
- universal_mcp/applications/figma/app.py +53 -137
- universal_mcp/applications/file_system/app.py +2 -13
- universal_mcp/applications/firecrawl/app.py +51 -152
- universal_mcp/applications/fireflies/app.py +59 -281
- universal_mcp/applications/fpl/app.py +91 -528
- universal_mcp/applications/fpl/utils/fixtures.py +15 -49
- universal_mcp/applications/fpl/utils/helper.py +25 -89
- universal_mcp/applications/fpl/utils/league_utils.py +20 -64
- universal_mcp/applications/ghost_content/app.py +52 -161
- universal_mcp/applications/github/app.py +19 -56
- universal_mcp/applications/gong/app.py +88 -248
- universal_mcp/applications/google_calendar/app.py +16 -68
- universal_mcp/applications/google_docs/app.py +88 -188
- universal_mcp/applications/google_drive/app.py +140 -462
- universal_mcp/applications/google_gemini/app.py +12 -64
- universal_mcp/applications/google_mail/app.py +28 -157
- universal_mcp/applications/google_searchconsole/app.py +15 -48
- universal_mcp/applications/google_sheet/app.py +101 -578
- universal_mcp/applications/google_sheet/helper.py +10 -37
- universal_mcp/applications/hashnode/app.py +57 -269
- universal_mcp/applications/heygen/app.py +44 -122
- universal_mcp/applications/http_tools/app.py +10 -32
- universal_mcp/applications/hubspot/api_segments/crm_api.py +460 -1573
- universal_mcp/applications/hubspot/api_segments/marketing_api.py +74 -262
- universal_mcp/applications/hubspot/app.py +23 -87
- universal_mcp/applications/jira/app.py +2071 -7986
- universal_mcp/applications/klaviyo/app.py +494 -1376
- universal_mcp/applications/linkedin/README.md +9 -2
- universal_mcp/applications/linkedin/app.py +392 -212
- universal_mcp/applications/mailchimp/app.py +450 -1605
- universal_mcp/applications/markitdown/app.py +8 -20
- universal_mcp/applications/miro/app.py +217 -699
- universal_mcp/applications/ms_teams/app.py +64 -186
- universal_mcp/applications/neon/app.py +86 -192
- universal_mcp/applications/notion/app.py +21 -36
- universal_mcp/applications/onedrive/app.py +14 -36
- universal_mcp/applications/openai/app.py +42 -165
- universal_mcp/applications/outlook/app.py +16 -76
- universal_mcp/applications/perplexity/app.py +4 -19
- universal_mcp/applications/pipedrive/app.py +832 -3142
- universal_mcp/applications/posthog/app.py +163 -432
- universal_mcp/applications/reddit/app.py +40 -139
- universal_mcp/applications/resend/app.py +41 -107
- universal_mcp/applications/retell/app.py +14 -41
- universal_mcp/applications/rocketlane/app.py +221 -934
- universal_mcp/applications/scraper/README.md +7 -4
- universal_mcp/applications/scraper/app.py +216 -102
- universal_mcp/applications/semanticscholar/app.py +22 -64
- universal_mcp/applications/semrush/app.py +43 -77
- universal_mcp/applications/sendgrid/app.py +512 -1262
- universal_mcp/applications/sentry/app.py +271 -906
- universal_mcp/applications/serpapi/app.py +40 -143
- universal_mcp/applications/sharepoint/app.py +15 -37
- universal_mcp/applications/shopify/app.py +1551 -4287
- universal_mcp/applications/shortcut/app.py +155 -417
- universal_mcp/applications/slack/app.py +50 -101
- universal_mcp/applications/spotify/app.py +126 -325
- universal_mcp/applications/supabase/app.py +104 -213
- universal_mcp/applications/tavily/app.py +1 -1
- universal_mcp/applications/trello/app.py +693 -2656
- universal_mcp/applications/twilio/app.py +14 -50
- universal_mcp/applications/twitter/api_segments/compliance_api.py +4 -14
- universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +6 -18
- universal_mcp/applications/twitter/api_segments/likes_api.py +1 -3
- universal_mcp/applications/twitter/api_segments/lists_api.py +5 -15
- universal_mcp/applications/twitter/api_segments/trends_api.py +1 -3
- universal_mcp/applications/twitter/api_segments/tweets_api.py +9 -31
- universal_mcp/applications/twitter/api_segments/usage_api.py +1 -5
- universal_mcp/applications/twitter/api_segments/users_api.py +14 -42
- universal_mcp/applications/whatsapp/app.py +35 -186
- universal_mcp/applications/whatsapp/audio.py +2 -6
- universal_mcp/applications/whatsapp/whatsapp.py +17 -51
- universal_mcp/applications/whatsapp_business/app.py +70 -283
- universal_mcp/applications/wrike/app.py +45 -118
- universal_mcp/applications/yahoo_finance/app.py +19 -65
- universal_mcp/applications/youtube/app.py +75 -261
- universal_mcp/applications/zenquotes/app.py +2 -2
- {universal_mcp_applications-0.1.30.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/METADATA +2 -2
- {universal_mcp_applications-0.1.30.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/RECORD +105 -105
- {universal_mcp_applications-0.1.30.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/WHEEL +0 -0
- {universal_mcp_applications-0.1.30.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
|
|
3
2
|
from universal_mcp.applications.application import APIApplication
|
|
4
3
|
from universal_mcp.integrations import Integration
|
|
5
4
|
|
|
@@ -9,20 +8,20 @@ class GoogleDocsApp(APIApplication):
|
|
|
9
8
|
super().__init__(name="google_docs", integration=integration)
|
|
10
9
|
self.base_api_url = "https://docs.googleapis.com/v1/documents"
|
|
11
10
|
|
|
12
|
-
def create_document(self, title: str) -> dict[str, Any]:
|
|
11
|
+
async def create_document(self, title: str) -> dict[str, Any]:
|
|
13
12
|
"""
|
|
14
|
-
Creates a blank Google Document with a specified title by sending a POST request to the Google Docs API. The function returns a dictionary containing the new document's metadata, including the unique document ID required by other functions for subsequent modifications or retrieval.
|
|
15
|
-
|
|
13
|
+
Creates a blank Google Document with a specified title by sending a POST request to the Google Docs API. The function returns a dictionary containing the new document's metadata, including the unique document ID required by other functions for subsequent modifications or retrieval. Note that you need to call other google_docs functions (e.g. `google_docs__insert_text`) to actually add content after creating the document.
|
|
14
|
+
|
|
16
15
|
Args:
|
|
17
16
|
title: The title for the new Google Document to be created.
|
|
18
|
-
|
|
17
|
+
|
|
19
18
|
Returns:
|
|
20
19
|
A dictionary containing the response from the Google Docs API with document details and metadata.
|
|
21
|
-
|
|
20
|
+
|
|
22
21
|
Raises:
|
|
23
22
|
HTTPError: If the API request fails due to network issues, authentication errors, or invalid parameters.
|
|
24
23
|
RequestException: If there are connection errors or timeout issues during the API request.
|
|
25
|
-
|
|
24
|
+
|
|
26
25
|
Tags:
|
|
27
26
|
create, document, api, important, google-docs, http
|
|
28
27
|
"""
|
|
@@ -30,22 +29,24 @@ class GoogleDocsApp(APIApplication):
|
|
|
30
29
|
document_data = {"title": title}
|
|
31
30
|
response = self._post(url, data=document_data)
|
|
32
31
|
response.raise_for_status()
|
|
33
|
-
|
|
32
|
+
payload = response.json()
|
|
33
|
+
payload["Note"] = "You must load and call other google docs content functions (like google_docs__insert_text)"
|
|
34
|
+
return payload
|
|
34
35
|
|
|
35
36
|
def get_document(self, document_id: str) -> dict[str, Any]:
|
|
36
37
|
"""
|
|
37
38
|
Retrieves the complete, raw JSON object for a Google Document by its ID. This function returns the full, unprocessed API response with all metadata and structural elements, distinguishing it from `get_document_content`, which parses this data to extract only the title and plain text.
|
|
38
|
-
|
|
39
|
+
|
|
39
40
|
Args:
|
|
40
41
|
document_id: The unique identifier of the Google Document to retrieve.
|
|
41
|
-
|
|
42
|
+
|
|
42
43
|
Returns:
|
|
43
44
|
A dictionary containing the complete document data as returned by the Google Docs API.
|
|
44
|
-
|
|
45
|
+
|
|
45
46
|
Raises:
|
|
46
47
|
HTTPError: If the API request fails or the specified document cannot be found.
|
|
47
48
|
JSONDecodeError: If the API response is not valid JSON and cannot be parsed.
|
|
48
|
-
|
|
49
|
+
|
|
49
50
|
Tags:
|
|
50
51
|
retrieve, read, api, document, google-docs, important
|
|
51
52
|
"""
|
|
@@ -53,7 +54,7 @@ class GoogleDocsApp(APIApplication):
|
|
|
53
54
|
response = self._get(url)
|
|
54
55
|
return response.json()
|
|
55
56
|
|
|
56
|
-
def get_document_content(self, document_id: str) -> dict[str, Any]:
|
|
57
|
+
async def get_document_content(self, document_id: str) -> dict[str, Any]:
|
|
57
58
|
"""
|
|
58
59
|
Retrieves and converts a Google Docs document into Markdown-formatted content.
|
|
59
60
|
|
|
@@ -90,7 +91,6 @@ class GoogleDocsApp(APIApplication):
|
|
|
90
91
|
inline_objects = response.get("inlineObjects", {})
|
|
91
92
|
lists = response.get("lists", {})
|
|
92
93
|
footnotes_data = response.get("footnotes", {})
|
|
93
|
-
|
|
94
94
|
text_chunks: list[str] = []
|
|
95
95
|
footnotes: dict[str, str] = {}
|
|
96
96
|
footnote_index: dict[str, int] = {}
|
|
@@ -132,7 +132,7 @@ class GoogleDocsApp(APIApplication):
|
|
|
132
132
|
"""Returns appropriate Markdown heading level."""
|
|
133
133
|
style = paragraph.get("paragraphStyle", {})
|
|
134
134
|
heading = style.get("namedStyleType", "")
|
|
135
|
-
match = re.match(
|
|
135
|
+
match = re.match("HEADING_(\\d)", heading)
|
|
136
136
|
if match:
|
|
137
137
|
level = int(match.group(1))
|
|
138
138
|
return "#" * level
|
|
@@ -147,7 +147,6 @@ class GoogleDocsApp(APIApplication):
|
|
|
147
147
|
nesting = paragraph["bullet"].get("nestingLevel", 0)
|
|
148
148
|
list_info = lists.get(list_id, {})
|
|
149
149
|
list_type = list_info.get("listProperties", {}).get("nestingLevels", [{}])[nesting].get("glyphType")
|
|
150
|
-
|
|
151
150
|
indent = " " * nesting
|
|
152
151
|
if list_type and "DECIMAL" in list_type:
|
|
153
152
|
current_list_counters[list_id] = current_list_counters.get(list_id, 1)
|
|
@@ -177,10 +176,8 @@ class GoogleDocsApp(APIApplication):
|
|
|
177
176
|
if "equation" in para:
|
|
178
177
|
text_chunks.append(extract_equation(para))
|
|
179
178
|
continue
|
|
180
|
-
|
|
181
179
|
heading_md = extract_heading_style(para)
|
|
182
180
|
list_prefix = extract_list_prefix(para)
|
|
183
|
-
|
|
184
181
|
para_text = extract_text_from_paragraph(para).strip()
|
|
185
182
|
if para_text:
|
|
186
183
|
if heading_md:
|
|
@@ -189,69 +186,50 @@ class GoogleDocsApp(APIApplication):
|
|
|
189
186
|
text_chunks.append(f"{list_prefix}{para_text}")
|
|
190
187
|
else:
|
|
191
188
|
text_chunks.append(para_text)
|
|
192
|
-
|
|
193
189
|
elif "table" in element:
|
|
194
190
|
table_md = extract_table(element["table"])
|
|
195
191
|
text_chunks.append(table_md)
|
|
196
|
-
|
|
197
192
|
elif "horizontalRule" in element:
|
|
198
193
|
text_chunks.append("\n---\n")
|
|
199
|
-
|
|
200
194
|
elif "tableOfContents" in element:
|
|
201
195
|
text_chunks.append("<!-- Table of Contents -->")
|
|
202
|
-
|
|
203
|
-
# Handle footnote references (inline elements)
|
|
204
196
|
elif "footnoteReference" in element:
|
|
205
197
|
footnote_id = element["footnoteReference"]["footnoteId"]
|
|
206
198
|
ref = extract_footnote_ref(footnote_id)
|
|
207
199
|
text_chunks.append(ref)
|
|
208
|
-
|
|
209
|
-
# Append footnotes at the end
|
|
210
200
|
if footnotes:
|
|
211
201
|
text_chunks.append("\n## Footnotes\n")
|
|
212
202
|
for fid, index in sorted(footnote_index.items(), key=lambda x: x[1]):
|
|
213
203
|
text_chunks.append(f"[^{index}]: {footnotes[fid]}")
|
|
204
|
+
content = "\n\n".join((chunk.strip() for chunk in text_chunks if chunk.strip()))
|
|
205
|
+
return {"title": title, "content": content}
|
|
214
206
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
"title": title,
|
|
219
|
-
"content": content
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
def insert_text(
|
|
224
|
-
self, document_id: str, content: str, index: int = 1
|
|
225
|
-
) -> dict[str, Any]:
|
|
207
|
+
async def insert_text(self, document_id: str, content: str, index: int = 1) -> dict[str, Any]:
|
|
226
208
|
"""
|
|
227
209
|
Inserts a text string at a specified index within a Google Document using the batchUpdate API. Unlike functions that format existing text or delete content ranges, this method specifically adds new textual content to the document body.
|
|
228
|
-
|
|
210
|
+
|
|
229
211
|
Args:
|
|
230
212
|
document_id: The unique identifier of the Google Document to be updated.
|
|
231
213
|
content: The text content to be inserted into the document.
|
|
232
214
|
index: The zero-based position in the document where the text should be inserted (default is 1).
|
|
233
|
-
|
|
215
|
+
|
|
234
216
|
Returns:
|
|
235
217
|
A dictionary containing the Google Docs API response after performing the batch update operation.
|
|
236
|
-
|
|
218
|
+
|
|
237
219
|
Raises:
|
|
238
220
|
HTTPError: If the API request fails, for example due to invalid document_id or insufficient permissions.
|
|
239
221
|
RequestException: If there are network connectivity issues or problems contacting the API endpoint.
|
|
240
|
-
|
|
222
|
+
|
|
241
223
|
Tags:
|
|
242
224
|
update, insert, document, api, google-docs, batch, content-management, important
|
|
243
225
|
"""
|
|
244
226
|
url = f"{self.base_api_url}/{document_id}:batchUpdate"
|
|
245
|
-
batch_update_data = {
|
|
246
|
-
"requests": [
|
|
247
|
-
{"insertText": {"location": {"index": index}, "text": content}}
|
|
248
|
-
]
|
|
249
|
-
}
|
|
227
|
+
batch_update_data = {"requests": [{"insertText": {"location": {"index": index}, "text": content}}]}
|
|
250
228
|
response = self._post(url, data=batch_update_data)
|
|
251
229
|
response.raise_for_status()
|
|
252
230
|
return response.json()
|
|
253
231
|
|
|
254
|
-
def apply_text_style(
|
|
232
|
+
async def apply_text_style(
|
|
255
233
|
self,
|
|
256
234
|
document_id: str,
|
|
257
235
|
start_index: int,
|
|
@@ -266,7 +244,7 @@ class GoogleDocsApp(APIApplication):
|
|
|
266
244
|
) -> dict[str, Any]:
|
|
267
245
|
"""
|
|
268
246
|
Applies character-level formatting (e.g., bold, italic, color, links) to a specified text range. This function modifies text attributes directly, distinguishing it from `update_paragraph_style` which handles block-level properties like alignment.
|
|
269
|
-
|
|
247
|
+
|
|
270
248
|
Args:
|
|
271
249
|
document_id: The unique identifier of the Google Document to update.
|
|
272
250
|
start_index: The zero-based start index of the text range to apply the style.
|
|
@@ -278,14 +256,14 @@ class GoogleDocsApp(APIApplication):
|
|
|
278
256
|
link_url: URL to apply as a hyperlink to the text.
|
|
279
257
|
foreground_color: RGB color dictionary with 'red', 'green', and 'blue' floats (0.0 to 1.0) for the text color.
|
|
280
258
|
background_color: RGB color dictionary with 'red', 'green', and 'blue' floats (0.0 to 1.0) for the text background color.
|
|
281
|
-
|
|
259
|
+
|
|
282
260
|
Returns:
|
|
283
261
|
A dictionary containing the Google Docs API response, or a message if no styling was applied.
|
|
284
|
-
|
|
262
|
+
|
|
285
263
|
Raises:
|
|
286
264
|
HTTPError: If the Google Docs API request fails.
|
|
287
265
|
RequestException: If there are network connectivity issues during the API request.
|
|
288
|
-
|
|
266
|
+
|
|
289
267
|
Tags:
|
|
290
268
|
style, format, text, document, api, google-docs, important
|
|
291
269
|
"""
|
|
@@ -345,7 +323,7 @@ class GoogleDocsApp(APIApplication):
|
|
|
345
323
|
response = self._post(url, data=batch_update_data)
|
|
346
324
|
return self._handle_response(response)
|
|
347
325
|
|
|
348
|
-
def update_paragraph_style(
|
|
326
|
+
async def update_paragraph_style(
|
|
349
327
|
self,
|
|
350
328
|
document_id: str,
|
|
351
329
|
start_index: int,
|
|
@@ -359,7 +337,7 @@ class GoogleDocsApp(APIApplication):
|
|
|
359
337
|
) -> dict[str, Any]:
|
|
360
338
|
"""
|
|
361
339
|
Applies paragraph-level formatting like alignment, named styles (e.g., 'HEADING_1'), and text direction to a text range in a Google Doc. Distinct from `apply_text_style`, which handles character formatting, this method modifies properties for entire paragraphs using the batchUpdate API.
|
|
362
|
-
|
|
340
|
+
|
|
363
341
|
Args:
|
|
364
342
|
document_id: The unique identifier of the Google Document to update.
|
|
365
343
|
start_index: The zero-based start index of the paragraph range to style.
|
|
@@ -370,14 +348,14 @@ class GoogleDocsApp(APIApplication):
|
|
|
370
348
|
spacing_mode: Spacing mode for the paragraph ('NEVER_COLLAPSE', 'COLLAPSE_LISTS').
|
|
371
349
|
segment_id: Optional segment ID for the text range.
|
|
372
350
|
tab_id: Optional tab ID for the text range.
|
|
373
|
-
|
|
351
|
+
|
|
374
352
|
Returns:
|
|
375
353
|
A dictionary containing the API response from the Google Docs batchUpdate request.
|
|
376
|
-
|
|
354
|
+
|
|
377
355
|
Raises:
|
|
378
356
|
HTTPError: If the API request to update the document fails due to an HTTP error.
|
|
379
357
|
RequestException: If there are network connectivity issues during the API request.
|
|
380
|
-
|
|
358
|
+
|
|
381
359
|
Tags:
|
|
382
360
|
style, format, paragraph, document, api, google-docs, batch, content-management, important
|
|
383
361
|
"""
|
|
@@ -405,50 +383,37 @@ class GoogleDocsApp(APIApplication):
|
|
|
405
383
|
range_obj["tabId"] = tab_id
|
|
406
384
|
batch_update_data = {
|
|
407
385
|
"requests": [
|
|
408
|
-
{
|
|
409
|
-
"updateParagraphStyle": {
|
|
410
|
-
"range": range_obj,
|
|
411
|
-
"paragraphStyle": paragraph_style,
|
|
412
|
-
"fields": ",".join(fields_to_update),
|
|
413
|
-
}
|
|
414
|
-
}
|
|
386
|
+
{"updateParagraphStyle": {"range": range_obj, "paragraphStyle": paragraph_style, "fields": ",".join(fields_to_update)}}
|
|
415
387
|
]
|
|
416
388
|
}
|
|
417
389
|
response = self._post(url, data=batch_update_data)
|
|
418
390
|
return self._handle_response(response)
|
|
419
391
|
|
|
420
|
-
def delete_content_range(
|
|
421
|
-
self,
|
|
422
|
-
document_id: str,
|
|
423
|
-
start_index: int,
|
|
424
|
-
end_index: int,
|
|
425
|
-
segment_id: str | None = None,
|
|
426
|
-
tab_id: str | None = None,
|
|
392
|
+
async def delete_content_range(
|
|
393
|
+
self, document_id: str, start_index: int, end_index: int, segment_id: str | None = None, tab_id: str | None = None
|
|
427
394
|
) -> dict[str, Any]:
|
|
428
395
|
"""
|
|
429
396
|
Removes content from a specified index range in a Google Document via the batchUpdate API. Unlike functions that delete entire elements (e.g., `delete_header`), this provides granular control by targeting content based on its precise start and end location, optionally within a specific segment or tab.
|
|
430
|
-
|
|
397
|
+
|
|
431
398
|
Args:
|
|
432
399
|
document_id: The unique identifier of the Google Document to be updated.
|
|
433
400
|
start_index: The zero-based start index of the content range to delete.
|
|
434
401
|
end_index: The zero-based end index of the content range to delete (exclusive).
|
|
435
402
|
segment_id: Optional; the ID of the header, footer, or footnote segment containing the content.
|
|
436
403
|
tab_id: Optional; the ID of the tab containing the content to delete.
|
|
437
|
-
|
|
404
|
+
|
|
438
405
|
Returns:
|
|
439
406
|
A dictionary representing the Google Docs API response after performing the delete operation.
|
|
440
|
-
|
|
407
|
+
|
|
441
408
|
Raises:
|
|
442
409
|
HTTPError: Raised when the API request fails due to issues such as invalid document ID or insufficient permissions.
|
|
443
410
|
RequestException: Raised when there are network connectivity issues or problems with the API endpoint.
|
|
444
|
-
|
|
411
|
+
|
|
445
412
|
Tags:
|
|
446
413
|
delete, remove, content, document, api, google-docs, batch, content-management, important
|
|
447
414
|
"""
|
|
448
415
|
url = f"{self.base_api_url}/{document_id}:batchUpdate"
|
|
449
|
-
delete_request: dict[str, Any] = {
|
|
450
|
-
"range": {"startIndex": start_index, "endIndex": end_index}
|
|
451
|
-
}
|
|
416
|
+
delete_request: dict[str, Any] = {"range": {"startIndex": start_index, "endIndex": end_index}}
|
|
452
417
|
if segment_id is not None:
|
|
453
418
|
delete_request["range"]["segmentId"] = segment_id
|
|
454
419
|
if tab_id is not None:
|
|
@@ -457,18 +422,12 @@ class GoogleDocsApp(APIApplication):
|
|
|
457
422
|
response = self._post(url, data=batch_update_data)
|
|
458
423
|
return self._handle_response(response)
|
|
459
424
|
|
|
460
|
-
def insert_table(
|
|
461
|
-
self,
|
|
462
|
-
document_id: str,
|
|
463
|
-
location_index: int,
|
|
464
|
-
rows: int,
|
|
465
|
-
columns: int,
|
|
466
|
-
segment_id: str = None,
|
|
467
|
-
tab_id: str = None,
|
|
425
|
+
async def insert_table(
|
|
426
|
+
self, document_id: str, location_index: int, rows: int, columns: int, segment_id: str = None, tab_id: str = None
|
|
468
427
|
) -> dict[str, Any]:
|
|
469
428
|
"""
|
|
470
429
|
Inserts a table with specified rows and columns at a given index in a Google Document using the batchUpdate API. It can optionally place the table within specific document segments, such as headers or footers, handling structural additions rather than text or style modifications.
|
|
471
|
-
|
|
430
|
+
|
|
472
431
|
Args:
|
|
473
432
|
document_id: The unique identifier of the Google Document to be updated.
|
|
474
433
|
location_index: The zero-based index within the document body or segment where the table should be inserted.
|
|
@@ -476,14 +435,14 @@ class GoogleDocsApp(APIApplication):
|
|
|
476
435
|
columns: The number of columns the inserted table should have.
|
|
477
436
|
segment_id: Optional ID of the header, footer, or footnote segment where the table will be inserted (if applicable).
|
|
478
437
|
tab_id: Optional ID of the tab containing the insertion location.
|
|
479
|
-
|
|
438
|
+
|
|
480
439
|
Returns:
|
|
481
440
|
A dictionary containing the response from the Google Docs API after performing the table insertion.
|
|
482
|
-
|
|
441
|
+
|
|
483
442
|
Raises:
|
|
484
443
|
HTTPError: Raised when the API request fails due to reasons such as invalid document ID or insufficient permissions.
|
|
485
444
|
RequestException: Raised when there are network connectivity issues or problems reaching the API endpoint.
|
|
486
|
-
|
|
445
|
+
|
|
487
446
|
Tags:
|
|
488
447
|
table, insert, document, api, google-docs, batch, content-management, important
|
|
489
448
|
"""
|
|
@@ -493,21 +452,11 @@ class GoogleDocsApp(APIApplication):
|
|
|
493
452
|
location["segmentId"] = segment_id
|
|
494
453
|
if tab_id is not None:
|
|
495
454
|
location["tabId"] = tab_id
|
|
496
|
-
batch_update_data = {
|
|
497
|
-
"requests": [
|
|
498
|
-
{
|
|
499
|
-
"insertTable": {
|
|
500
|
-
"location": location,
|
|
501
|
-
"rows": rows,
|
|
502
|
-
"columns": columns,
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
]
|
|
506
|
-
}
|
|
455
|
+
batch_update_data = {"requests": [{"insertTable": {"location": location, "rows": rows, "columns": columns}}]}
|
|
507
456
|
response = self._post(url, data=batch_update_data)
|
|
508
457
|
return self._handle_response(response)
|
|
509
458
|
|
|
510
|
-
def create_footer(
|
|
459
|
+
async def create_footer(
|
|
511
460
|
self,
|
|
512
461
|
document_id: str,
|
|
513
462
|
footer_type: str = "DEFAULT",
|
|
@@ -517,21 +466,21 @@ class GoogleDocsApp(APIApplication):
|
|
|
517
466
|
) -> dict[str, Any]:
|
|
518
467
|
"""
|
|
519
468
|
Creates a footer of a specified type in a Google Document using the batch update API. This function, distinct from `create_header`, can optionally associate the new footer with a specific section break, enabling section-specific footers within the document.
|
|
520
|
-
|
|
469
|
+
|
|
521
470
|
Args:
|
|
522
471
|
document_id: The unique identifier of the Google Document to update.
|
|
523
472
|
footer_type: The type of footer to create, such as 'DEFAULT' or 'HEADER_FOOTER_TYPE_UNSPECIFIED'.
|
|
524
473
|
section_break_location_index: Optional index of the SectionBreak location to associate with the footer.
|
|
525
474
|
section_break_segment_id: Optional segment ID of the SectionBreak location.
|
|
526
475
|
section_break_tab_id: Optional tab ID of the SectionBreak location.
|
|
527
|
-
|
|
476
|
+
|
|
528
477
|
Returns:
|
|
529
478
|
A dictionary containing the Google Docs API response from the create footer operation.
|
|
530
|
-
|
|
479
|
+
|
|
531
480
|
Raises:
|
|
532
481
|
HTTPError: Raised when the API request fails due to reasons like invalid document_id or insufficient permissions.
|
|
533
482
|
RequestException: Raised when there are network connectivity issues or problems with the API endpoint.
|
|
534
|
-
|
|
483
|
+
|
|
535
484
|
Tags:
|
|
536
485
|
footer, create, document, api, google-docs, batch, content-management, important
|
|
537
486
|
"""
|
|
@@ -539,19 +488,16 @@ class GoogleDocsApp(APIApplication):
|
|
|
539
488
|
create_footer_request = {"type": footer_type}
|
|
540
489
|
if section_break_location_index is not None:
|
|
541
490
|
section_break_location = {"index": section_break_location_index}
|
|
542
|
-
|
|
543
491
|
if section_break_segment_id is not None:
|
|
544
492
|
section_break_location["segmentId"] = section_break_segment_id
|
|
545
|
-
|
|
546
493
|
if section_break_tab_id is not None:
|
|
547
494
|
section_break_location["tabId"] = section_break_tab_id
|
|
548
|
-
|
|
549
495
|
create_footer_request["sectionBreakLocation"] = section_break_location
|
|
550
496
|
batch_update_data = {"requests": [{"createFooter": create_footer_request}]}
|
|
551
497
|
response = self._post(url, data=batch_update_data)
|
|
552
498
|
return self._handle_response(response)
|
|
553
499
|
|
|
554
|
-
def create_footnote(
|
|
500
|
+
async def create_footnote(
|
|
555
501
|
self,
|
|
556
502
|
document_id: str,
|
|
557
503
|
location_index: int = None,
|
|
@@ -563,7 +509,7 @@ class GoogleDocsApp(APIApplication):
|
|
|
563
509
|
) -> dict[str, Any]:
|
|
564
510
|
"""
|
|
565
511
|
Inserts a numbered footnote reference into a Google Document using the batchUpdate API. The footnote can be placed at a precise index or at the end of a document segment, distinct from the `create_footer` function which adds standard page footers.
|
|
566
|
-
|
|
512
|
+
|
|
567
513
|
Args:
|
|
568
514
|
document_id: The unique identifier of the Google Document to be updated.
|
|
569
515
|
location_index: The zero-based index within the document where the footnote reference will be inserted (optional if inserting at end of segment).
|
|
@@ -572,68 +518,53 @@ class GoogleDocsApp(APIApplication):
|
|
|
572
518
|
end_of_segment_location: If True, inserts the footnote reference at the end of a segment instead of a specific index (default is False).
|
|
573
519
|
end_of_segment_segment_id: The segment ID indicating where to insert the footnote at the end of a segment (optional).
|
|
574
520
|
end_of_segment_tab_id: The tab ID for the end-of-segment location (optional).
|
|
575
|
-
|
|
521
|
+
|
|
576
522
|
Returns:
|
|
577
523
|
A dictionary containing the response from the Google Docs API after performing the footnote creation operation.
|
|
578
|
-
|
|
524
|
+
|
|
579
525
|
Raises:
|
|
580
526
|
HTTPError: Raised when the API request fails, such as due to an invalid document ID or insufficient permissions.
|
|
581
527
|
RequestException: Raised when there are network connectivity issues or problems reaching the API endpoint.
|
|
582
|
-
|
|
528
|
+
|
|
583
529
|
Tags:
|
|
584
530
|
footnote, create, document, api, google-docs, batch, content-management, important
|
|
585
531
|
"""
|
|
586
532
|
url = f"{self.base_api_url}/{document_id}:batchUpdate"
|
|
587
533
|
create_footnote_request = {}
|
|
588
534
|
if end_of_segment_location:
|
|
589
|
-
# Use endOfSegmentLocation
|
|
590
535
|
end_of_segment_location_obj = {}
|
|
591
|
-
|
|
592
536
|
if end_of_segment_segment_id is not None:
|
|
593
537
|
end_of_segment_location_obj["segmentId"] = end_of_segment_segment_id
|
|
594
|
-
|
|
595
538
|
if end_of_segment_tab_id is not None:
|
|
596
539
|
end_of_segment_location_obj["tabId"] = end_of_segment_tab_id
|
|
597
|
-
|
|
598
|
-
create_footnote_request["endOfSegmentLocation"] = (
|
|
599
|
-
end_of_segment_location_obj
|
|
600
|
-
)
|
|
540
|
+
create_footnote_request["endOfSegmentLocation"] = end_of_segment_location_obj
|
|
601
541
|
else:
|
|
602
|
-
# Use specific location
|
|
603
542
|
location = {"index": location_index}
|
|
604
|
-
|
|
605
543
|
if location_segment_id is not None:
|
|
606
544
|
location["segmentId"] = location_segment_id
|
|
607
|
-
|
|
608
545
|
if location_tab_id is not None:
|
|
609
546
|
location["tabId"] = location_tab_id
|
|
610
|
-
|
|
611
547
|
create_footnote_request["location"] = location
|
|
612
548
|
batch_update_data = {"requests": [{"createFootnote": create_footnote_request}]}
|
|
613
549
|
response = self._post(url, data=batch_update_data)
|
|
614
550
|
return self._handle_response(response)
|
|
615
551
|
|
|
616
|
-
def delete_footer(
|
|
617
|
-
self,
|
|
618
|
-
document_id: str,
|
|
619
|
-
footer_id: str,
|
|
620
|
-
tab_id: str = None,
|
|
621
|
-
) -> dict[str, Any]:
|
|
552
|
+
async def delete_footer(self, document_id: str, footer_id: str, tab_id: str = None) -> dict[str, Any]:
|
|
622
553
|
"""
|
|
623
554
|
Deletes a specific footer from a Google Document using its unique ID via a batchUpdate API request. This operation removes the entire footer object, optionally within a specific tab, distinguishing it from functions that delete headers (`delete_header`) or general content (`delete_content_range`).
|
|
624
|
-
|
|
555
|
+
|
|
625
556
|
Args:
|
|
626
557
|
document_id: The unique identifier of the Google Document to be updated.
|
|
627
558
|
footer_id: The identifier of the footer to delete.
|
|
628
559
|
tab_id: Optional identifier of the tab containing the footer to delete.
|
|
629
|
-
|
|
560
|
+
|
|
630
561
|
Returns:
|
|
631
562
|
A dictionary containing the response from the Google Docs API after performing the delete footer operation.
|
|
632
|
-
|
|
563
|
+
|
|
633
564
|
Raises:
|
|
634
565
|
HTTPError: Raised when the API request fails due to reasons such as an invalid document ID or insufficient permissions.
|
|
635
566
|
RequestException: Raised for network-related issues or problems reaching the API endpoint.
|
|
636
|
-
|
|
567
|
+
|
|
637
568
|
Tags:
|
|
638
569
|
footer, delete, remove, document, api, google-docs, batch, content-management, important
|
|
639
570
|
"""
|
|
@@ -645,7 +576,7 @@ class GoogleDocsApp(APIApplication):
|
|
|
645
576
|
response = self._post(url, data=batch_update_data)
|
|
646
577
|
return self._handle_response(response)
|
|
647
578
|
|
|
648
|
-
def create_header(
|
|
579
|
+
async def create_header(
|
|
649
580
|
self,
|
|
650
581
|
document_id: str,
|
|
651
582
|
header_type: str = "DEFAULT",
|
|
@@ -655,21 +586,21 @@ class GoogleDocsApp(APIApplication):
|
|
|
655
586
|
) -> dict[str, Any]:
|
|
656
587
|
"""
|
|
657
588
|
Creates a header of a specified type in a Google Document using the batchUpdate API. This function can optionally associate the new header with a specific section break, distinguishing it from the `create_footer` method, which performs the equivalent action for footers.
|
|
658
|
-
|
|
589
|
+
|
|
659
590
|
Args:
|
|
660
591
|
document_id: The unique identifier of the Google Document to be updated.
|
|
661
592
|
header_type: The type of header to create, e.g., 'DEFAULT' or 'HEADER_FOOTER_TYPE_UNSPECIFIED'.
|
|
662
593
|
section_break_location_index: The index position of the section break location within the document, if applicable.
|
|
663
594
|
section_break_segment_id: The segment ID associated with the section break location, if applicable.
|
|
664
595
|
section_break_tab_id: The tab ID associated with the section break location, if applicable.
|
|
665
|
-
|
|
596
|
+
|
|
666
597
|
Returns:
|
|
667
598
|
A dictionary containing the response from the Google Docs API after the header creation request.
|
|
668
|
-
|
|
599
|
+
|
|
669
600
|
Raises:
|
|
670
601
|
HTTPError: If the API request fails due to issues such as an invalid document ID or insufficient permissions.
|
|
671
602
|
RequestException: If there are network problems or issues reaching the API endpoint.
|
|
672
|
-
|
|
603
|
+
|
|
673
604
|
Tags:
|
|
674
605
|
header, create, document, api, google-docs, batch, content-management, important
|
|
675
606
|
"""
|
|
@@ -677,39 +608,31 @@ class GoogleDocsApp(APIApplication):
|
|
|
677
608
|
create_header_request = {"type": header_type}
|
|
678
609
|
if section_break_location_index is not None:
|
|
679
610
|
section_break_location = {"index": section_break_location_index}
|
|
680
|
-
|
|
681
611
|
if section_break_segment_id is not None:
|
|
682
612
|
section_break_location["segmentId"] = section_break_segment_id
|
|
683
|
-
|
|
684
613
|
if section_break_tab_id is not None:
|
|
685
614
|
section_break_location["tabId"] = section_break_tab_id
|
|
686
|
-
|
|
687
615
|
create_header_request["sectionBreakLocation"] = section_break_location
|
|
688
616
|
batch_update_data = {"requests": [{"createHeader": create_header_request}]}
|
|
689
617
|
response = self._post(url, data=batch_update_data)
|
|
690
618
|
return self._handle_response(response)
|
|
691
619
|
|
|
692
|
-
def delete_header(
|
|
693
|
-
self,
|
|
694
|
-
document_id: str,
|
|
695
|
-
header_id: str,
|
|
696
|
-
tab_id: str = None,
|
|
697
|
-
) -> dict[str, Any]:
|
|
620
|
+
async def delete_header(self, document_id: str, header_id: str, tab_id: str = None) -> dict[str, Any]:
|
|
698
621
|
"""
|
|
699
622
|
Deletes a specific header from a Google Document using its unique ID via a batchUpdate API request. This function, the counterpart to `create_header`, removes headers and can optionally target a header within a specific tab. It requires both the document and header IDs for the operation.
|
|
700
|
-
|
|
623
|
+
|
|
701
624
|
Args:
|
|
702
625
|
document_id: The unique identifier of the Google Document to be updated.
|
|
703
626
|
header_id: The ID of the header to delete.
|
|
704
627
|
tab_id: Optional ID of the tab containing the header to delete.
|
|
705
|
-
|
|
628
|
+
|
|
706
629
|
Returns:
|
|
707
630
|
A dictionary containing the response from the Google Docs API after performing the delete header operation.
|
|
708
|
-
|
|
631
|
+
|
|
709
632
|
Raises:
|
|
710
633
|
HTTPError: Raised when the API request fails due to invalid document_id, insufficient permissions, or other HTTP errors.
|
|
711
634
|
RequestException: Raised when network connectivity issues or API endpoint problems occur during the request.
|
|
712
|
-
|
|
635
|
+
|
|
713
636
|
Tags:
|
|
714
637
|
header, delete, remove, document, api, google-docs, batch, content-management, important
|
|
715
638
|
"""
|
|
@@ -721,18 +644,12 @@ class GoogleDocsApp(APIApplication):
|
|
|
721
644
|
response = self._post(url, data=batch_update_data)
|
|
722
645
|
return self._handle_response(response)
|
|
723
646
|
|
|
724
|
-
def apply_list_style(
|
|
725
|
-
self,
|
|
726
|
-
document_id: str,
|
|
727
|
-
start_index: int,
|
|
728
|
-
end_index: int,
|
|
729
|
-
bullet_preset: str,
|
|
730
|
-
segment_id: str = None,
|
|
731
|
-
tab_id: str = None,
|
|
647
|
+
async def apply_list_style(
|
|
648
|
+
self, document_id: str, start_index: int, end_index: int, bullet_preset: str, segment_id: str = None, tab_id: str = None
|
|
732
649
|
) -> dict[str, Any]:
|
|
733
650
|
"""
|
|
734
651
|
Applies a predefined list style (bulleted or numbered) to paragraphs within a specified range using a chosen preset. Unlike `delete_paragraph_bullets`, which removes list formatting, this function creates it, distinguishing it from other text and paragraph styling methods in the class.
|
|
735
|
-
|
|
652
|
+
|
|
736
653
|
Args:
|
|
737
654
|
document_id: The unique identifier of the Google Document to be updated.
|
|
738
655
|
start_index: The zero-based start index of the text range to which the list style should be applied.
|
|
@@ -740,14 +657,14 @@ class GoogleDocsApp(APIApplication):
|
|
|
740
657
|
bullet_preset: Specifies the bullet or numbering style preset to use (e.g., bulleted or numbered formats with specific glyphs).
|
|
741
658
|
segment_id: Optional segment ID within the document where the updates apply.
|
|
742
659
|
tab_id: Optional tab ID within the segment to narrow the update scope.
|
|
743
|
-
|
|
660
|
+
|
|
744
661
|
Returns:
|
|
745
662
|
A dictionary representing the Google Docs API response confirming the application of the bullet list style.
|
|
746
|
-
|
|
663
|
+
|
|
747
664
|
Raises:
|
|
748
665
|
HTTPError: Raised when the API request to update the document fails (e.g., invalid document ID or insufficient permissions).
|
|
749
666
|
RequestException: Raised on network issues or problems reaching the API endpoint.
|
|
750
|
-
|
|
667
|
+
|
|
751
668
|
Tags:
|
|
752
669
|
bullets, list, paragraph, document, api, google-docs, batch, content-management, important
|
|
753
670
|
"""
|
|
@@ -757,44 +674,30 @@ class GoogleDocsApp(APIApplication):
|
|
|
757
674
|
range_obj["segmentId"] = segment_id
|
|
758
675
|
if tab_id is not None:
|
|
759
676
|
range_obj["tabId"] = tab_id
|
|
760
|
-
batch_update_data = {
|
|
761
|
-
"requests": [
|
|
762
|
-
{
|
|
763
|
-
"createParagraphBullets": {
|
|
764
|
-
"range": range_obj,
|
|
765
|
-
"bulletPreset": bullet_preset,
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
]
|
|
769
|
-
}
|
|
677
|
+
batch_update_data = {"requests": [{"createParagraphBullets": {"range": range_obj, "bulletPreset": bullet_preset}}]}
|
|
770
678
|
response = self._post(url, data=batch_update_data)
|
|
771
679
|
return self._handle_response(response)
|
|
772
680
|
|
|
773
|
-
def delete_paragraph_bullets(
|
|
774
|
-
self,
|
|
775
|
-
document_id: str,
|
|
776
|
-
start_index: int,
|
|
777
|
-
end_index: int,
|
|
778
|
-
segment_id: str = None,
|
|
779
|
-
tab_id: str = None,
|
|
681
|
+
async def delete_paragraph_bullets(
|
|
682
|
+
self, document_id: str, start_index: int, end_index: int, segment_id: str = None, tab_id: str = None
|
|
780
683
|
) -> dict[str, Any]:
|
|
781
684
|
"""
|
|
782
685
|
Removes bullet points or numbering from paragraphs within a specified index range in a Google Document. This reverts list formatting to normal text while preserving content, acting as the inverse operation to the `apply_list_style` function.
|
|
783
|
-
|
|
686
|
+
|
|
784
687
|
Args:
|
|
785
688
|
document_id: The unique identifier of the Google Document to be updated.
|
|
786
689
|
start_index: The zero-based start index of the range to remove bullets from.
|
|
787
690
|
end_index: The zero-based end index of the range to remove bullets from (exclusive).
|
|
788
691
|
segment_id: Optional segment ID specifying a subset of the document where the range applies.
|
|
789
692
|
tab_id: Optional tab ID specifying a particular tab within the document where the range applies.
|
|
790
|
-
|
|
693
|
+
|
|
791
694
|
Returns:
|
|
792
695
|
A dictionary containing the Google Docs API response after performing the delete bullets operation.
|
|
793
|
-
|
|
696
|
+
|
|
794
697
|
Raises:
|
|
795
698
|
HTTPError: Raised when the API request fails due to invalid document ID, insufficient permissions, or other server-side errors.
|
|
796
699
|
RequestException: Raised when there are network connectivity issues or problems accessing the API endpoint.
|
|
797
|
-
|
|
700
|
+
|
|
798
701
|
Tags:
|
|
799
702
|
bullets, delete, remove, list, paragraph, document, api, google-docs, batch, content-management
|
|
800
703
|
"""
|
|
@@ -804,16 +707,13 @@ class GoogleDocsApp(APIApplication):
|
|
|
804
707
|
range_obj["segmentId"] = segment_id
|
|
805
708
|
if tab_id is not None:
|
|
806
709
|
range_obj["tabId"] = tab_id
|
|
807
|
-
batch_update_data = {
|
|
808
|
-
"requests": [{"deleteParagraphBullets": {"range": range_obj}}]
|
|
809
|
-
}
|
|
710
|
+
batch_update_data = {"requests": [{"deleteParagraphBullets": {"range": range_obj}}]}
|
|
810
711
|
response = self._post(url, data=batch_update_data)
|
|
811
712
|
return self._handle_response(response)
|
|
812
713
|
|
|
813
714
|
def list_tools(self):
|
|
814
715
|
return [
|
|
815
716
|
self.create_document,
|
|
816
|
-
# self.get_document,
|
|
817
717
|
self.get_document_content,
|
|
818
718
|
self.insert_text,
|
|
819
719
|
self.apply_text_style,
|