mcpcn-office-powerpoint-mcp-server 2.1.1__py3-none-any.whl → 2.1.2__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.
- {mcpcn_office_powerpoint_mcp_server-2.1.1.dist-info → mcpcn_office_powerpoint_mcp_server-2.1.2.dist-info}/METADATA +82 -30
- mcpcn_office_powerpoint_mcp_server-2.1.2.dist-info/RECORD +25 -0
- {mcpcn_office_powerpoint_mcp_server-2.1.1.dist-info → mcpcn_office_powerpoint_mcp_server-2.1.2.dist-info}/WHEEL +1 -1
- {mcpcn_office_powerpoint_mcp_server-2.1.1.dist-info → mcpcn_office_powerpoint_mcp_server-2.1.2.dist-info}/licenses/LICENSE +20 -20
- ppt_mcp_server.py +474 -474
- slide_layout_templates.json +3689 -3689
- tools/__init__.py +27 -27
- tools/chart_tools.py +81 -81
- tools/connector_tools.py +90 -90
- tools/content_tools.py +966 -778
- tools/hyperlink_tools.py +137 -137
- tools/master_tools.py +113 -113
- tools/presentation_tools.py +211 -211
- tools/professional_tools.py +289 -289
- tools/structural_tools.py +372 -372
- tools/template_tools.py +520 -520
- tools/transition_tools.py +74 -74
- utils/__init__.py +69 -68
- utils/content_utils.py +633 -578
- utils/core_utils.py +54 -54
- utils/design_utils.py +688 -688
- utils/presentation_utils.py +216 -216
- utils/template_utils.py +1142 -1142
- utils/validation_utils.py +322 -322
- mcpcn_office_powerpoint_mcp_server-2.1.1.dist-info/RECORD +0 -25
- {mcpcn_office_powerpoint_mcp_server-2.1.1.dist-info → mcpcn_office_powerpoint_mcp_server-2.1.2.dist-info}/entry_points.txt +0 -0
utils/core_utils.py
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Core utility functions for PowerPoint MCP Server.
|
|
3
|
-
Basic operations and error handling.
|
|
4
|
-
"""
|
|
5
|
-
from typing import Any, Callable, List, Tuple, Optional
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def try_multiple_approaches(operation_name: str, approaches: List[Tuple[Callable, str]]) -> Tuple[Any, Optional[str]]:
|
|
9
|
-
"""
|
|
10
|
-
Try multiple approaches to perform an operation, returning the first successful result.
|
|
11
|
-
|
|
12
|
-
Args:
|
|
13
|
-
operation_name: Name of the operation for error reporting
|
|
14
|
-
approaches: List of (approach_func, description) tuples to try
|
|
15
|
-
|
|
16
|
-
Returns:
|
|
17
|
-
Tuple of (result, None) if any approach succeeded, or (None, error_messages) if all failed
|
|
18
|
-
"""
|
|
19
|
-
error_messages = []
|
|
20
|
-
|
|
21
|
-
for approach_func, description in approaches:
|
|
22
|
-
try:
|
|
23
|
-
result = approach_func()
|
|
24
|
-
return result, None
|
|
25
|
-
except Exception as e:
|
|
26
|
-
error_messages.append(f"{description}: {str(e)}")
|
|
27
|
-
|
|
28
|
-
return None, f"Failed to {operation_name} after trying multiple approaches: {'; '.join(error_messages)}"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def safe_operation(operation_name: str, operation_func: Callable, error_message: Optional[str] = None, *args, **kwargs) -> Tuple[Any, Optional[str]]:
|
|
32
|
-
"""
|
|
33
|
-
Execute an operation safely with standard error handling.
|
|
34
|
-
|
|
35
|
-
Args:
|
|
36
|
-
operation_name: Name of the operation for error reporting
|
|
37
|
-
operation_func: Function to execute
|
|
38
|
-
error_message: Custom error message (optional)
|
|
39
|
-
*args, **kwargs: Arguments to pass to the operation function
|
|
40
|
-
|
|
41
|
-
Returns:
|
|
42
|
-
A tuple (result, error) where error is None if operation was successful
|
|
43
|
-
"""
|
|
44
|
-
try:
|
|
45
|
-
result = operation_func(*args, **kwargs)
|
|
46
|
-
return result, None
|
|
47
|
-
except ValueError as e:
|
|
48
|
-
error_msg = error_message or f"Invalid input for {operation_name}: {str(e)}"
|
|
49
|
-
return None, error_msg
|
|
50
|
-
except TypeError as e:
|
|
51
|
-
error_msg = error_message or f"Type error in {operation_name}: {str(e)}"
|
|
52
|
-
return None, error_msg
|
|
53
|
-
except Exception as e:
|
|
54
|
-
error_msg = error_message or f"Failed to execute {operation_name}: {str(e)}"
|
|
1
|
+
"""
|
|
2
|
+
Core utility functions for PowerPoint MCP Server.
|
|
3
|
+
Basic operations and error handling.
|
|
4
|
+
"""
|
|
5
|
+
from typing import Any, Callable, List, Tuple, Optional
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def try_multiple_approaches(operation_name: str, approaches: List[Tuple[Callable, str]]) -> Tuple[Any, Optional[str]]:
|
|
9
|
+
"""
|
|
10
|
+
Try multiple approaches to perform an operation, returning the first successful result.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
operation_name: Name of the operation for error reporting
|
|
14
|
+
approaches: List of (approach_func, description) tuples to try
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
Tuple of (result, None) if any approach succeeded, or (None, error_messages) if all failed
|
|
18
|
+
"""
|
|
19
|
+
error_messages = []
|
|
20
|
+
|
|
21
|
+
for approach_func, description in approaches:
|
|
22
|
+
try:
|
|
23
|
+
result = approach_func()
|
|
24
|
+
return result, None
|
|
25
|
+
except Exception as e:
|
|
26
|
+
error_messages.append(f"{description}: {str(e)}")
|
|
27
|
+
|
|
28
|
+
return None, f"Failed to {operation_name} after trying multiple approaches: {'; '.join(error_messages)}"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def safe_operation(operation_name: str, operation_func: Callable, error_message: Optional[str] = None, *args, **kwargs) -> Tuple[Any, Optional[str]]:
|
|
32
|
+
"""
|
|
33
|
+
Execute an operation safely with standard error handling.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
operation_name: Name of the operation for error reporting
|
|
37
|
+
operation_func: Function to execute
|
|
38
|
+
error_message: Custom error message (optional)
|
|
39
|
+
*args, **kwargs: Arguments to pass to the operation function
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
A tuple (result, error) where error is None if operation was successful
|
|
43
|
+
"""
|
|
44
|
+
try:
|
|
45
|
+
result = operation_func(*args, **kwargs)
|
|
46
|
+
return result, None
|
|
47
|
+
except ValueError as e:
|
|
48
|
+
error_msg = error_message or f"Invalid input for {operation_name}: {str(e)}"
|
|
49
|
+
return None, error_msg
|
|
50
|
+
except TypeError as e:
|
|
51
|
+
error_msg = error_message or f"Type error in {operation_name}: {str(e)}"
|
|
52
|
+
return None, error_msg
|
|
53
|
+
except Exception as e:
|
|
54
|
+
error_msg = error_message or f"Failed to execute {operation_name}: {str(e)}"
|
|
55
55
|
return None, error_msg
|