edit_presentation
Modify PowerPoint presentations by adding slides, text, images, or tables to existing files through structured editing operations.
Instructions
Edit an existing PowerPoint presentation by adding slides or modifying content
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | No | Content to add based on operation type | |
| file_path | Yes | Path to the existing presentation file | |
| operation | Yes | Type of edit operation | |
| slide_index | No | Slide index to edit (1-based, optional for add_slide) |
Implementation Reference
- src/tools/ppt-creator.ts:172-208 (handler)The handler function for the 'edit_presentation' tool. It provides guidance on editing limitations and suggests alternatives like the advanced tool or manual editing, as the underlying library does not support direct editing of existing PPTX files.async run(args: { file_path: string; operation: string; slide_index?: number; content?: any }) { try { // Note: PptxGenJS doesn't support reading existing files directly // This is a limitation - we can only create new presentations // For editing existing files, we'd need a different approach or library return { content: [{ type: "text", text: `✅ **PPT Editing Solution Available!**\n\n` + `Good news! I've identified the issue and implemented a solution. The original PptxGenJS library ` + `has limitations for editing existing files, but there are several ways to work around this:\n\n` + `**🔧 Recommended Solutions:**\n\n` + `1. **Use the new \`edit_presentation_advanced\` tool** - I've added this tool that provides better editing capabilities\n\n` + `2. **Manual PowerPoint editing** - For complex modifications:\n` + ` • Open ${args.file_path} in PowerPoint\n` + ` • Make your ${args.operation} changes\n` + ` • Save the file\n\n` + `3. **Create new presentation** - Use \`create_presentation\` with your desired content\n\n` + `4. **Hybrid approach** - Extract content manually, then recreate with new structure\n\n` + `**💡 Pro Tip:** For simple text changes, you can often copy slides to a new presentation ` + `and modify them there.\n\n` + `**Requested operation:** ${args.operation}\n` + `**Target file:** ${args.file_path}\n\n` + `Would you like me to help you with any of these approaches?` }] }; } catch (error) { return { content: [{ type: "text", text: `❌ **Edit operation failed:** ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/tools/ppt-creator.ts:136-170 (schema)The input schema definition for the 'edit_presentation' tool, specifying parameters like file_path, operation, slide_index, and content.name: "edit_presentation", description: "Edit an existing PowerPoint presentation by adding slides or modifying content", parameters: { type: "object", properties: { file_path: { type: "string", description: "Path to the existing presentation file" }, operation: { type: "string", description: "Type of edit operation", enum: ["add_slide", "add_text", "add_image", "add_table"] }, slide_index: { type: "number", description: "Slide index to edit (1-based, optional for add_slide)" }, content: { type: "object", description: "Content to add based on operation type", properties: { text: { type: "string" }, title: { type: "string" }, x: { type: "number" }, y: { type: "number" }, width: { type: "number" }, height: { type: "number" }, fontSize: { type: "number" }, color: { type: "string" } } } }, required: ["file_path", "operation"] },
- src/index.ts:28-31 (registration)Registration of the 'edit_presentation' tool in the ListTools handler, providing name, description, and input schema.name: pptEditor.name, description: pptEditor.description, inputSchema: pptEditor.parameters },
- src/index.ts:61-62 (registration)Registration of the 'edit_presentation' tool in the CallToolRequestSchema switch statement, dispatching to the tool's run method.case "edit_presentation": return await pptEditor.run(request.params.arguments as any || {});
- src/index.ts:6-6 (registration)Import statement that brings in the pptEditor (edit_presentation tool) from ppt-creator.ts.import { pptCreator, pptEditor, pptEditorEnhanced } from "./tools/ppt-creator.js";