add-slide-section-header
Add a section header slide to PowerPoint presentations by specifying presentation name, header, and optional subtitle. Simplify organization and clarity in slide decks.
Instructions
This tool adds a section header (a.k.a segue) slide to the presentation you are working on. The tool doesn't return anything. It requires the presentation_name to work on.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| header | Yes | Section header title | |
| presentation_name | Yes | Name of the presentation to add the slide to | |
| subtitle | No | Section header subtitle |
Implementation Reference
- Core handler function that executes the tool logic: adds a section header slide using python-pptx, setting header as title and optional subtitle.def add_section_header_slide(self, presentation_name: str, header: str, subtitle: str): """ Create a section header slide for the given presentation Args: presentation_name: The presentation to add the slide to header: The section header to use subtitle: The subtitle of the section header to use """ 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_SECTION_HEADER] slide = prs.slides.add_slide(slide_layout) # Set the subtitle if subtitle: subtitle_shape = slide.placeholders[1] text_frame = subtitle_shape.text_frame text_frame.text = subtitle # Set the section header if header: header_shape = slide.shapes.title header_shape.text = header return slide
- src/powerpoint/server.py:100-123 (registration)Tool registration including name, description, and input schema definition within the list_tools() function.types.Tool( name="add-slide-section-header", description="This tool adds a section header (a.k.a segue) slide to the presentation you are working on. The tool doesn't " "return anything. It requires the presentation_name to work on.", inputSchema={ "type": "object", "properties": { "presentation_name": { "type": "string", "description": "Name of the presentation to add the slide to", }, "header": { "type": "string", "description": "Section header title", }, "subtitle": { "type": "string", "description": "Section header subtitle", } }, "required": ["presentation_name", "header"], }, ),
- src/powerpoint/server.py:532-553 (handler)Dispatching handler in call_tool() that validates arguments and delegates to PresentationManager.add_section_header_slide.elif name == "add-slide-section-header": presentation_name = arguments.get("presentation_name") header = arguments.get("header") subtitle = arguments.get("subtitle") if not all([presentation_name, header]): 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_section_header_slide(presentation_name, header, subtitle) except Exception as e: raise ValueError(f"Unable to add slide '{header}' to presentation: {presentation_name}") return [ types.TextContent( type="text", text=f"Added slide '{header}' to presentation: {presentation_name}" ) ]