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.
tools/transition_tools.py CHANGED
@@ -1,75 +1,75 @@
1
- """
2
- Slide transition management tools for PowerPoint MCP Server.
3
- Implements slide transition and timing capabilities.
4
- """
5
-
6
- from typing import Dict, List, Optional, Any
7
-
8
- def register_transition_tools(app, presentations, get_current_presentation_id, validate_parameters,
9
- is_positive, is_non_negative, is_in_range, is_valid_rgb):
10
- """Register slide transition management tools with the FastMCP app."""
11
-
12
- @app.tool()
13
- def manage_slide_transitions(
14
- slide_index: int,
15
- operation: str,
16
- transition_type: str = None,
17
- duration: float = 1.0,
18
- presentation_id: str = None
19
- ) -> Dict:
20
- """
21
- Manage slide transitions and timing.
22
-
23
- Args:
24
- slide_index: Index of the slide (0-based)
25
- operation: Operation type ("set", "remove", "get")
26
- transition_type: Type of transition (basic support)
27
- duration: Duration of transition in seconds
28
- presentation_id: Optional presentation ID (uses current if not provided)
29
-
30
- Returns:
31
- Dictionary with transition information
32
- """
33
- try:
34
- # Get presentation
35
- pres_id = presentation_id or get_current_presentation_id()
36
- if pres_id not in presentations:
37
- return {"error": "Presentation not found"}
38
-
39
- pres = presentations[pres_id]
40
-
41
- # Validate slide index
42
- if not (0 <= slide_index < len(pres.slides)):
43
- return {"error": f"Slide index {slide_index} out of range"}
44
-
45
- slide = pres.slides[slide_index]
46
-
47
- if operation == "get":
48
- # Get current transition info (limited python-pptx support)
49
- return {
50
- "message": f"Transition info for slide {slide_index}",
51
- "slide_index": slide_index,
52
- "note": "Transition reading has limited support in python-pptx"
53
- }
54
-
55
- elif operation == "set":
56
- return {
57
- "message": f"Transition setting requested for slide {slide_index}",
58
- "slide_index": slide_index,
59
- "transition_type": transition_type,
60
- "duration": duration,
61
- "note": "Transition setting has limited support in python-pptx - this is a placeholder for future enhancement"
62
- }
63
-
64
- elif operation == "remove":
65
- return {
66
- "message": f"Transition removal requested for slide {slide_index}",
67
- "slide_index": slide_index,
68
- "note": "Transition removal has limited support in python-pptx - this is a placeholder for future enhancement"
69
- }
70
-
71
- else:
72
- return {"error": f"Unsupported operation: {operation}. Use 'set', 'remove', or 'get'"}
73
-
74
- except Exception as e:
1
+ """
2
+ Slide transition management tools for PowerPoint MCP Server.
3
+ Implements slide transition and timing capabilities.
4
+ """
5
+
6
+ from typing import Dict, List, Optional, Any
7
+
8
+ def register_transition_tools(app, presentations, get_current_presentation_id, validate_parameters,
9
+ is_positive, is_non_negative, is_in_range, is_valid_rgb):
10
+ """Register slide transition management tools with the FastMCP app."""
11
+
12
+ @app.tool()
13
+ def manage_slide_transitions(
14
+ slide_index: int,
15
+ operation: str,
16
+ transition_type: str = None,
17
+ duration: float = 1.0,
18
+ presentation_id: str = None
19
+ ) -> Dict:
20
+ """
21
+ Manage slide transitions and timing.
22
+
23
+ Args:
24
+ slide_index: Index of the slide (0-based)
25
+ operation: Operation type ("set", "remove", "get")
26
+ transition_type: Type of transition (basic support)
27
+ duration: Duration of transition in seconds
28
+ presentation_id: Optional presentation ID (uses current if not provided)
29
+
30
+ Returns:
31
+ Dictionary with transition information
32
+ """
33
+ try:
34
+ # Get presentation
35
+ pres_id = presentation_id or get_current_presentation_id()
36
+ if pres_id not in presentations:
37
+ return {"error": "Presentation not found"}
38
+
39
+ pres = presentations[pres_id]
40
+
41
+ # Validate slide index
42
+ if not (0 <= slide_index < len(pres.slides)):
43
+ return {"error": f"Slide index {slide_index} out of range"}
44
+
45
+ slide = pres.slides[slide_index]
46
+
47
+ if operation == "get":
48
+ # Get current transition info (limited python-pptx support)
49
+ return {
50
+ "message": f"Transition info for slide {slide_index}",
51
+ "slide_index": slide_index,
52
+ "note": "Transition reading has limited support in python-pptx"
53
+ }
54
+
55
+ elif operation == "set":
56
+ return {
57
+ "message": f"Transition setting requested for slide {slide_index}",
58
+ "slide_index": slide_index,
59
+ "transition_type": transition_type,
60
+ "duration": duration,
61
+ "note": "Transition setting has limited support in python-pptx - this is a placeholder for future enhancement"
62
+ }
63
+
64
+ elif operation == "remove":
65
+ return {
66
+ "message": f"Transition removal requested for slide {slide_index}",
67
+ "slide_index": slide_index,
68
+ "note": "Transition removal has limited support in python-pptx - this is a placeholder for future enhancement"
69
+ }
70
+
71
+ else:
72
+ return {"error": f"Unsupported operation: {operation}. Use 'set', 'remove', or 'get'"}
73
+
74
+ except Exception as e:
75
75
  return {"error": f"Failed to manage slide transitions: {str(e)}"}
utils/__init__.py CHANGED
@@ -1,69 +1,70 @@
1
- """
2
- PowerPoint utilities package.
3
- Organized utility functions for PowerPoint manipulation.
4
- """
5
-
6
- from .core_utils import *
7
- from .presentation_utils import *
8
- from .content_utils import *
9
- from .design_utils import *
10
- from .validation_utils import *
11
-
12
- __all__ = [
13
- # Core utilities
14
- "safe_operation",
15
- "try_multiple_approaches",
16
-
17
- # Presentation utilities
18
- "create_presentation",
19
- "open_presentation",
20
- "save_presentation",
21
- "create_presentation_from_template",
22
- "get_presentation_info",
23
- "get_template_info",
24
- "set_core_properties",
25
- "get_core_properties",
26
-
27
- # Content utilities
28
- "add_slide",
29
- "get_slide_info",
30
- "set_title",
31
- "populate_placeholder",
32
- "add_bullet_points",
33
- "add_textbox",
34
- "format_text",
35
- "format_text_advanced",
36
- "add_image",
37
- "add_table",
38
- "format_table_cell",
39
- "add_chart",
40
- "format_chart",
41
-
42
- # Design utilities
43
- "get_professional_color",
44
- "get_professional_font",
45
- "get_color_schemes",
46
- "add_professional_slide",
47
- "apply_professional_theme",
48
- "enhance_existing_slide",
49
- "apply_professional_image_enhancement",
50
- "enhance_image_with_pillow",
51
- "set_slide_gradient_background",
52
- "create_professional_gradient_background",
53
- "format_shape",
54
- "apply_picture_shadow",
55
- "apply_picture_reflection",
56
- "apply_picture_glow",
57
- "apply_picture_soft_edges",
58
- "apply_picture_rotation",
59
- "apply_picture_transparency",
60
- "apply_picture_bevel",
61
- "apply_picture_filter",
62
- "analyze_font_file",
63
- "optimize_font_for_presentation",
64
- "get_font_recommendations",
65
-
66
- # Validation utilities
67
- "validate_text_fit",
68
- "validate_and_fix_slide"
1
+ """
2
+ PowerPoint utilities package.
3
+ Organized utility functions for PowerPoint manipulation.
4
+ """
5
+
6
+ from .core_utils import *
7
+ from .presentation_utils import *
8
+ from .content_utils import *
9
+ from .design_utils import *
10
+ from .validation_utils import *
11
+
12
+ __all__ = [
13
+ # Core utilities
14
+ "safe_operation",
15
+ "try_multiple_approaches",
16
+
17
+ # Presentation utilities
18
+ "create_presentation",
19
+ "open_presentation",
20
+ "save_presentation",
21
+ "create_presentation_from_template",
22
+ "get_presentation_info",
23
+ "get_template_info",
24
+ "set_core_properties",
25
+ "get_core_properties",
26
+
27
+ # Content utilities
28
+ "add_slide",
29
+ "move_slide",
30
+ "get_slide_info",
31
+ "set_title",
32
+ "populate_placeholder",
33
+ "add_bullet_points",
34
+ "add_textbox",
35
+ "format_text",
36
+ "format_text_advanced",
37
+ "add_image",
38
+ "add_table",
39
+ "format_table_cell",
40
+ "add_chart",
41
+ "format_chart",
42
+
43
+ # Design utilities
44
+ "get_professional_color",
45
+ "get_professional_font",
46
+ "get_color_schemes",
47
+ "add_professional_slide",
48
+ "apply_professional_theme",
49
+ "enhance_existing_slide",
50
+ "apply_professional_image_enhancement",
51
+ "enhance_image_with_pillow",
52
+ "set_slide_gradient_background",
53
+ "create_professional_gradient_background",
54
+ "format_shape",
55
+ "apply_picture_shadow",
56
+ "apply_picture_reflection",
57
+ "apply_picture_glow",
58
+ "apply_picture_soft_edges",
59
+ "apply_picture_rotation",
60
+ "apply_picture_transparency",
61
+ "apply_picture_bevel",
62
+ "apply_picture_filter",
63
+ "analyze_font_file",
64
+ "optimize_font_for_presentation",
65
+ "get_font_recommendations",
66
+
67
+ # Validation utilities
68
+ "validate_text_fit",
69
+ "validate_and_fix_slide"
69
70
  ]