add-slide-comparison
Create a comparison slide in PowerPoint to contrast two concepts, including titles and structured content for each side, within a specified presentation.
Instructions
Add a new a comparison slide with title and comparison content. Use when you wish to compare two concepts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| left_side_content | Yes | Content/body text of left concept. Separate main points with a single carriage return character.Make sub-points with tab character.Do not use bullet points, asterisks or dashes for points.Max main points is 4 | |
| left_side_title | Yes | Title of the left concept | |
| presentation_name | Yes | Name of the presentation to add the slide to | |
| right_side_content | Yes | Content/body text of right concept. Separate main points with a single carriage return character.Make sub-points with tab character.Do not use bullet points, asterisks or dashes for points.Max main points is 4 | |
| right_side_title | Yes | Title of the right concept | |
| title | Yes | Title of the slide |
Implementation Reference
- Core handler function that adds a comparison slide to the presentation using predefined layout index 4 (SLIDE_LAYOUT_COMPARISON). Sets title in shapes.title and contents in placeholders 1-4 for left/right titles and bodies.def add_comparison_slide(self, presentation_name: str, title: str, left_side_title: str, left_side_content: str, right_side_title: str, right_side_content: str ): """ Create a section header slide for the given presentation Args: presentation_name: The presentation to add the slide to title: The title of the slide left_side_title: The title of the left hand side content left_side_content: The body content for the left hand side right_side_title: The title of the right hand side content right_side_content: The body content for the right hand side """ try: prs = self.presentations[presentation_name] except KeyError as e: raise ValueError(f"Presentation '{presentation_name}' not found") slide_master = prs.slide_master # Add a new slide with layout slide_layout = prs.slide_layouts[self.SLIDE_LAYOUT_COMPARISON] slide = prs.slides.add_slide(slide_layout) # Set the title title_shape = slide.shapes.title title_shape.text = title # Build the left hand content content_shape = slide.placeholders[1] text_frame = content_shape.text_frame text_frame.text = left_side_title content_shape = slide.placeholders[2] text_frame = content_shape.text_frame text_frame.text = left_side_content # Build the right hand content content_shape = slide.placeholders[3] text_frame = content_shape.text_frame text_frame.text = right_side_title content_shape = slide.placeholders[4] text_frame = content_shape.text_frame text_frame.text = right_side_content return slide
- src/powerpoint/server.py:435-459 (handler)MCP tool dispatcher handler for 'add-slide-comparison': validates arguments, retrieves presentation, calls PresentationManager.add_comparison_slide, and returns success message.elif name == "add-slide-comparison": # Get arguments presentation_name = arguments["presentation_name"] title = arguments["title"] left_side_title = arguments["left_side_title"] left_side_content = arguments["left_side_content"] right_side_title = arguments["right_side_title"] right_side_content = arguments["right_side_content"] if not all([presentation_name, title, left_side_title, left_side_content, right_side_title, right_side_content]): raise ValueError("Missing required arguments") if presentation_name not in presentation_manager.presentations: raise ValueError(f"Presentation not found: {presentation_name}") try: slide = presentation_manager.add_comparison_slide(presentation_name, title, left_side_title, left_side_content, right_side_title, right_side_content) except Exception as e: raise ValueError(f"Unable to add comparison slide to {presentation_name}.pptx") return [types.TextContent( type="text", text=f"Successfully added comparison slide {title} to {presentation_name}.pptx" )]
- src/powerpoint/server.py:150-193 (schema)Tool schema definition including input schema with all required parameters for the add-slide-comparison tool, registered in the list_tools handler.types.Tool( name="add-slide-comparison", description="Add a new a comparison slide with title and comparison content. Use when you wish to " "compare two concepts", inputSchema={ "type": "object", "properties": { "presentation_name": { "type": "string", "description": "Name of the presentation to add the slide to", }, "title": { "type": "string", "description": "Title of the slide", }, "left_side_title": { "type": "string", "description": "Title of the left concept", }, "left_side_content": { "type": "string", "description": "Content/body text of left concept. " "Separate main points with a single carriage return character." "Make sub-points with tab character." "Do not use bullet points, asterisks or dashes for points." "Max main points is 4" }, "right_side_title": { "type": "string", "description": "Title of the right concept", }, "right_side_content": { "type": "string", "description": "Content/body text of right concept. " "Separate main points with a single carriage return character." "Make sub-points with tab character." "Do not use bullet points, asterisks or dashes for points." "Max main points is 4" }, }, "required": ["presentation_name", "title", "left_side_title", "left_side_content", "right_side_title", "right_side_content"], }, ),
- Layout constant used for comparison slides (index 4).SLIDE_LAYOUT_COMPARISON = 4