google-workspace-mcp 1.0.5__py3-none-any.whl → 1.1.5__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.
- google_workspace_mcp/__main__.py +6 -5
- google_workspace_mcp/services/drive.py +39 -12
- google_workspace_mcp/services/slides.py +2033 -57
- google_workspace_mcp/tools/add_image.py +1781 -0
- google_workspace_mcp/tools/calendar.py +12 -17
- google_workspace_mcp/tools/docs_tools.py +24 -32
- google_workspace_mcp/tools/drive.py +264 -21
- google_workspace_mcp/tools/gmail.py +27 -36
- google_workspace_mcp/tools/sheets_tools.py +18 -25
- google_workspace_mcp/tools/slides.py +774 -55
- google_workspace_mcp/utils/unit_conversion.py +201 -0
- {google_workspace_mcp-1.0.5.dist-info → google_workspace_mcp-1.1.5.dist-info}/METADATA +2 -2
- {google_workspace_mcp-1.0.5.dist-info → google_workspace_mcp-1.1.5.dist-info}/RECORD +15 -13
- {google_workspace_mcp-1.0.5.dist-info → google_workspace_mcp-1.1.5.dist-info}/WHEEL +0 -0
- {google_workspace_mcp-1.0.5.dist-info → google_workspace_mcp-1.1.5.dist-info}/entry_points.txt +0 -0
google_workspace_mcp/__main__.py
CHANGED
@@ -19,13 +19,12 @@ from google_workspace_mcp.resources import drive as drive_resources # noqa: F40
|
|
19
19
|
from google_workspace_mcp.resources import gmail as gmail_resources # noqa: F401
|
20
20
|
from google_workspace_mcp.resources import sheets_resources # noqa: F401
|
21
21
|
from google_workspace_mcp.resources import slides as slides_resources # noqa: F401
|
22
|
-
from google_workspace_mcp.tools import calendar as calendar_tools # noqa: F401
|
23
22
|
|
24
23
|
# Register tools
|
25
|
-
from google_workspace_mcp.tools import
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
from google_workspace_mcp.tools import add_image as add_image_tools # noqa: F401
|
25
|
+
from google_workspace_mcp.tools import calendar as calendar_tools # noqa: F401
|
26
|
+
from google_workspace_mcp.tools import docs_tools # noqa: F401
|
27
|
+
from google_workspace_mcp.tools import sheets_tools # noqa: F401
|
29
28
|
from google_workspace_mcp.tools import drive as drive_tools # noqa: F401
|
30
29
|
from google_workspace_mcp.tools import gmail as gmail_tools # noqa: F401
|
31
30
|
from google_workspace_mcp.tools import slides as slides_tools # noqa: F401
|
@@ -41,3 +40,5 @@ def main():
|
|
41
40
|
|
42
41
|
if __name__ == "__main__":
|
43
42
|
main()
|
43
|
+
if __name__ == "__main__":
|
44
|
+
main()
|
@@ -27,8 +27,29 @@ class DriveService(BaseGoogleService):
|
|
27
27
|
"""Initialize the Drive service."""
|
28
28
|
super().__init__("drive", "v3")
|
29
29
|
|
30
|
+
def _escape_drive_query(self, query: str) -> str:
|
31
|
+
"""
|
32
|
+
Basic query cleaning for Drive API queries.
|
33
|
+
|
34
|
+
Args:
|
35
|
+
query: Query string (users should manually escape apostrophes with \')
|
36
|
+
|
37
|
+
Returns:
|
38
|
+
Cleaned query string for Drive API
|
39
|
+
"""
|
40
|
+
# Simply remove surrounding double quotes if present
|
41
|
+
# Users should handle apostrophe escaping manually (e.g., John\'s Documents)
|
42
|
+
if query.startswith('"') and query.endswith('"'):
|
43
|
+
query = query[1:-1]
|
44
|
+
|
45
|
+
return query
|
46
|
+
|
30
47
|
def search_files(
|
31
|
-
self,
|
48
|
+
self,
|
49
|
+
query: str,
|
50
|
+
page_size: int = 10,
|
51
|
+
shared_drive_id: str | None = None,
|
52
|
+
include_shared_drives: bool = True,
|
32
53
|
) -> list[dict[str, Any]]:
|
33
54
|
"""
|
34
55
|
Search for files in Google Drive.
|
@@ -37,36 +58,42 @@ class DriveService(BaseGoogleService):
|
|
37
58
|
query: Search query string
|
38
59
|
page_size: Maximum number of files to return (1-1000)
|
39
60
|
shared_drive_id: Optional shared drive ID to search within a specific shared drive
|
61
|
+
include_shared_drives: Whether to include shared drives in search (default True)
|
40
62
|
|
41
63
|
Returns:
|
42
64
|
List of file metadata dictionaries (id, name, mimeType, etc.) or an error dictionary
|
43
65
|
"""
|
44
66
|
try:
|
45
67
|
logger.info(
|
46
|
-
f"Searching files with query: '{query}', page_size: {page_size},
|
68
|
+
f"Searching files with query: '{query}', page_size: {page_size}, "
|
69
|
+
f"shared_drive_id: {shared_drive_id}, include_shared_drives: {include_shared_drives}"
|
47
70
|
)
|
48
71
|
|
49
72
|
# Validate and constrain page_size
|
50
73
|
page_size = max(1, min(page_size, 1000))
|
51
74
|
|
52
|
-
#
|
75
|
+
# Properly escape the query for Drive API
|
76
|
+
escaped_query = self._escape_drive_query(query)
|
77
|
+
|
78
|
+
# Build list parameters with comprehensive shared drive support
|
53
79
|
list_params = {
|
54
|
-
"q":
|
80
|
+
"q": escaped_query,
|
55
81
|
"pageSize": page_size,
|
56
|
-
"fields": "files(id, name, mimeType, modifiedTime, size, webViewLink, iconLink)",
|
82
|
+
"fields": "files(id, name, mimeType, modifiedTime, size, webViewLink, iconLink, parents)",
|
57
83
|
"supportsAllDrives": True,
|
58
84
|
"includeItemsFromAllDrives": True,
|
59
85
|
}
|
60
86
|
|
61
87
|
if shared_drive_id:
|
88
|
+
# Search within a specific shared drive
|
62
89
|
list_params["driveId"] = shared_drive_id
|
63
|
-
list_params["corpora"] =
|
64
|
-
|
65
|
-
)
|
90
|
+
list_params["corpora"] = "drive"
|
91
|
+
elif include_shared_drives:
|
92
|
+
# Search across all drives (user's files + shared drives + shared folders)
|
93
|
+
list_params["corpora"] = "allDrives"
|
66
94
|
else:
|
67
|
-
|
68
|
-
|
69
|
-
)
|
95
|
+
# Search only user's personal files
|
96
|
+
list_params["corpora"] = "user"
|
70
97
|
|
71
98
|
results = self.service.files().list(**list_params).execute()
|
72
99
|
files = results.get("files", [])
|
@@ -234,7 +261,7 @@ class DriveService(BaseGoogleService):
|
|
234
261
|
# Export the file
|
235
262
|
try:
|
236
263
|
request = self.service.files().export_media(
|
237
|
-
fileId=file_id, mimeType=export_mime_type
|
264
|
+
fileId=file_id, mimeType=export_mime_type, supportsAllDrives=True
|
238
265
|
)
|
239
266
|
|
240
267
|
content_bytes = self._download_content(request)
|