add-slide-title-only
Add a title slide to a PowerPoint presentation by specifying the presentation name and slide title. Simplifies slide creation within the Powerpoint MCP Server.
Instructions
This tool adds a new title 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 |
|---|---|---|---|
| presentation_name | Yes | Name of the presentation to add the slide to | |
| title | Yes | Title of the slide |
Implementation Reference
- src/powerpoint/server.py:81-99 (registration)Registration of the 'add-slide-title-only' tool including its description and input schema (presentation_name and title).types.Tool( name="add-slide-title-only", description="This tool adds a new title 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", }, "title": { "type": "string", "description": "Title of the slide", } }, "required": ["presentation_name", "title"], }, ),
- src/powerpoint/server.py:628-648 (handler)Dispatch handler for 'add-slide-title-only' tool: validates input arguments, retrieves the presentation, calls PresentationManager.add_title_slide method, handles errors, and returns confirmation text.elif name == "add-slide-title-only": presentation_name = arguments.get("presentation_name") title = arguments.get("title") if not all([presentation_name, title]): 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_title_slide(presentation_name, title) except Exception as e: raise ValueError(f"Unable to add '{title} to presentation: {presentation_name}. Error: {e}") return [ types.TextContent( type="text", text=f"Added slide '{title}' to presentation: {presentation_name}" ) ]
- Core implementation of adding a title-only slide: retrieves the presentation object, adds a new slide using title layout (index 0), sets the slide title, and returns the slide object.def add_title_slide(self, presentation_name: str, title: str) -> Slide: try: prs = self.presentations[presentation_name] except KeyError as e: raise ValueError(f"Presentation '{presentation_name}' not found") # Add a slide with title and content slide_layout = prs.slide_layouts[self.SLIDE_LAYOUT_TITLE] slide = prs.slides.add_slide(slide_layout) # Set the title title_shape = slide.shapes.title title_shape.text = title return slide