universal-mcp-applications 0.1.27rc2__py3-none-any.whl → 0.1.27rc3__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.

@@ -2,6 +2,7 @@ import base64
2
2
  import os
3
3
  from typing import Any
4
4
 
5
+ from loguru import logger
5
6
  from universal_mcp.applications.application import APIApplication
6
7
  from universal_mcp.integrations import Integration
7
8
 
@@ -271,13 +272,17 @@ class OnedriveApp(APIApplication):
271
272
 
272
273
  def get_document_content(self, item_id: str) -> dict[str, Any]:
273
274
  """
274
- Retrieves the content of a file specified by its ID. It automatically detects if the file is text or binary; text content is returned as a string, while binary content is returned base64-encoded. This differs from `download_file`, which only provides a URL.
275
+ Retrieves the content of a file from OneDrive and formats it as a dictionary, similar to an email attachment.
275
276
 
276
277
  Args:
277
278
  item_id (str): The ID of the file.
278
279
 
279
280
  Returns:
280
- A dictionary containing the file content. For text files, content is string. For binary, it's base64 encoded.
281
+ dict[str, Any]: A dictionary containing the file details:
282
+ - 'type' (str): The general type of the file (e.g., "image", "audio", "video", "file").
283
+ - 'data' (str): The base64 encoded content of the file.
284
+ - 'mime_type' (str): The MIME type of the file.
285
+ - 'file_name' (str): The name of the file.
281
286
 
282
287
  Tags:
283
288
  get, content, read, file, important
@@ -290,34 +295,29 @@ class OnedriveApp(APIApplication):
290
295
  if not file_metadata:
291
296
  raise ValueError(f"Item with ID '{item_id}' is not a file.")
292
297
 
293
- file_mime_type = file_metadata.get("mimeType", "")
298
+ file_mime_type = file_metadata.get("mimeType", "application/octet-stream")
299
+ file_name = metadata.get("name")
294
300
 
295
- url = f"{self.base_url}/me/drive/items/{item_id}/content"
296
- response = self._get(url)
297
-
298
- if response.status_code >= 400:
299
- # Try to handle as JSON error response from Graph API
300
- return self._handle_response(response)
301
+ download_url = metadata.get("@microsoft.graph.downloadUrl")
302
+ if not download_url:
303
+ logger.error(f"Could not find @microsoft.graph.downloadUrl in metadata for item {item_id}")
304
+ raise ValueError("Could not retrieve download URL for the item.")
301
305
 
302
- content = response.content
306
+ response = self._get(download_url)
303
307
 
304
- is_text = file_mime_type.startswith("text/") or any(t in file_mime_type for t in ["json", "xml", "csv", "javascript", "html"])
308
+ response.raise_for_status()
305
309
 
306
- content_dict = {}
307
- if is_text:
308
- try:
309
- content_dict["content"] = content.decode("utf-8")
310
- except UnicodeDecodeError:
311
- is_text = False
310
+ content = response.content
312
311
 
313
- if not is_text:
314
- content_dict["content_base64"] = base64.b64encode(content).decode("ascii")
312
+ attachment_type = file_mime_type.split("/")[0] if "/" in file_mime_type else "file"
313
+ if attachment_type not in ["image", "audio", "video", "text"]:
314
+ attachment_type = "file"
315
315
 
316
316
  return {
317
- "name": metadata.get("name"),
318
- "content_type": "text" if is_text else "binary",
319
- **content_dict,
320
- "size": len(content),
317
+ "type": attachment_type,
318
+ "data": content,
319
+ "mime_type": file_mime_type,
320
+ "file_name": file_name,
321
321
  }
322
322
 
323
323
  def list_tools(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: universal-mcp-applications
3
- Version: 0.1.27rc2
3
+ Version: 0.1.27rc3
4
4
  Summary: A Universal MCP Application: universal_mcp_applications
5
5
  Project-URL: Homepage, https://github.com/universal-mcp/applications
6
6
  Project-URL: Repository, https://github.com/universal-mcp/applications
@@ -167,7 +167,7 @@ universal_mcp/applications/notion/__init__.py,sha256=Qg3nadJs3ku-IozE8nVdWUmzBSp
167
167
  universal_mcp/applications/notion/app.py,sha256=3KyC8D0QQtn60O4Rf1ctqVVZ4GJLh_lRngH9dD8mR_g,20681
168
168
  universal_mcp/applications/onedrive/README.md,sha256=kOTKnd4l9pZl8Wx8tu310FfROWEECvEBQ1YvTPk3dp8,4085
169
169
  universal_mcp/applications/onedrive/__init__.py,sha256=9uhv1jX0RdosE6oUiFFagbCmpKVUlWA5uRhvvdrjP2Q,29
170
- universal_mcp/applications/onedrive/app.py,sha256=zIN0DAxcZu95f4Tk_Dj0Sd2gDFmkGq1lnWcXDwBLc0o,14413
170
+ universal_mcp/applications/onedrive/app.py,sha256=qMZGMI0NZRyRNjFyZaEJFjlBUPJgruW94UybHAoLUQU,14435
171
171
  universal_mcp/applications/openai/README.md,sha256=ag81IFx8utvlY6isaFDoq21Y-Z_9IYthMqJtq4iJKTU,3820
172
172
  universal_mcp/applications/openai/__init__.py,sha256=7h2xDZdb1pRh7ZDLtFK9BNDEbRHbjMma1GsVpxycvos,27
173
173
  universal_mcp/applications/openai/app.py,sha256=5pW85lC5SsojpQNPTZO4QkGkDAcLk8M3nvl1m1Bi0Vk,34123
@@ -279,7 +279,7 @@ universal_mcp/applications/youtube/app.py,sha256=eqgqe0b53W9Mj0FZGW3ZqY3xkGF4NbO
279
279
  universal_mcp/applications/zenquotes/README.md,sha256=FJyoTGRCaZjF_bsCBqg1CrYcvIfuUG_Qk616G1wjhF8,512
280
280
  universal_mcp/applications/zenquotes/__init__.py,sha256=C5nEHZ3Xy6nYUarq0BqQbbJnHs0UtSlqhk0DqmvWiHk,58
281
281
  universal_mcp/applications/zenquotes/app.py,sha256=7xIEnSZWAGYu5583Be2ZjSCtLUAfMWRzucSpp7hw_h4,1299
282
- universal_mcp_applications-0.1.27rc2.dist-info/METADATA,sha256=98sqd21bERCyTgWPIqSeNYT8vPjGxsifItg7Jz1FPXk,2959
283
- universal_mcp_applications-0.1.27rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
284
- universal_mcp_applications-0.1.27rc2.dist-info/licenses/LICENSE,sha256=NweDZVPslBAZFzlgByF158b85GR0f5_tLQgq1NS48To,1063
285
- universal_mcp_applications-0.1.27rc2.dist-info/RECORD,,
282
+ universal_mcp_applications-0.1.27rc3.dist-info/METADATA,sha256=3BHaDpmqQHV1pe3xtNIa0BHbQNlRuRwN8Gc1KKLV0q4,2959
283
+ universal_mcp_applications-0.1.27rc3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
284
+ universal_mcp_applications-0.1.27rc3.dist-info/licenses/LICENSE,sha256=NweDZVPslBAZFzlgByF158b85GR0f5_tLQgq1NS48To,1063
285
+ universal_mcp_applications-0.1.27rc3.dist-info/RECORD,,