save-presentation
Export PowerPoint presentations to a specified file path using the MCP server. Automatically saves output after adding slides, ensuring changes are stored securely for future use.
Instructions
Save the presentation to a file. Always use this tool at the end of any process that has added slides to a presentation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output_path | No | Path where to save the presentation (optional) | |
| presentation_name | Yes | Name of the presentation to save |
Input Schema (JSON Schema)
{
"properties": {
"output_path": {
"description": "Path where to save the presentation (optional)",
"type": "string"
},
"presentation_name": {
"description": "Name of the presentation to save",
"type": "string"
}
},
"required": [
"presentation_name"
],
"type": "object"
}
Implementation Reference
- src/powerpoint/server.py:649-678 (handler)The handler logic for the 'save-presentation' tool. It retrieves the presentation object from the PresentationManager, determines the output file path, saves the presentation using the python-pptx library's prs.save() method, and returns a confirmation message.elif name == "save-presentation": presentation_name = arguments.get("presentation_name") output_path = arguments.get("output_path") if not presentation_name: raise ValueError("Missing presentation name") if presentation_name not in presentation_manager.presentations: raise ValueError(f"Presentation not found: {presentation_name}") prs = presentation_manager.presentations[presentation_name] # Default output path if none provided if not output_path: output_path = f"{presentation_name}.pptx" file_path = os.path.join(path,output_path) # Save the presentation try: prs.save(file_path) except Exception as e: raise ValueError(f"Unable to save the {presentation_name}. Error: {e}") return [ types.TextContent( type="text", text=f"Saved presentation to: {file_path}" ) ]
- src/powerpoint/server.py:343-361 (registration)Registers the 'save-presentation' tool in the list_tools handler, including its description and input schema requiring 'presentation_name' and optionally 'output_path'.types.Tool( name="save-presentation", description="Save the presentation to a file. Always use this tool at the end of any process that has " "added slides to a presentation.", inputSchema={ "type": "object", "properties": { "presentation_name": { "type": "string", "description": "Name of the presentation to save", }, "output_path": { "type": "string", "description": "Path where to save the presentation (optional)", }, }, "required": ["presentation_name"], }, ),