Skip to main content
Glama

create_presentation

Generate a new PowerPoint presentation with custom title, slide count, and template style for structured content delivery.

Instructions

Create a new PowerPoint presentation with specified title and number of slides

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
output_pathNoOutput file path (optional, defaults to current directory)
slidesNoNumber of slides to create (default: 1)
templateNoPresentation template stylebasic
titleYesTitle of the presentation

Implementation Reference

  • Core handler function that creates PowerPoint presentation using pptxgenjs, applies templates, generates slides, saves to file, and returns success/error response.
    async run(args: { title: string; slides?: number; output_path?: string; template?: string }) {
      try {
        // Parameter validation
        if (!args.title) {
          throw new Error("Title is required");
        }
    
        const slideCount = args.slides || 1;
        const template = args.template || "basic";
        const outputPath = args.output_path || `${args.title.replace(/[^a-zA-Z0-9]/g, '_')}.pptx`;
    
        // Create new presentation
        const pres = new pptxgen();
        
        // Set presentation properties
        pres.author = "PPT-MCP";
        pres.company = "Generated by PPT-MCP";
        pres.title = args.title;
        
        // Apply template styling
        const templateStyles = getTemplateStyles(template);
        
        // Create title slide
        const titleSlide = pres.addSlide();
        titleSlide.addText(args.title, {
          x: 1,
          y: 2,
          w: 8,
          h: 2,
          fontSize: 44,
          bold: true,
          align: "center",
          color: templateStyles.titleColor
        });
        
        titleSlide.addText("Created with PPT-MCP", {
          x: 1,
          y: 5,
          w: 8,
          h: 1,
          fontSize: 18,
          align: "center",
          color: templateStyles.subtitleColor
        });
        
        // Create additional slides
        for (let i = 2; i <= slideCount; i++) {
          const slide = pres.addSlide();
          slide.addText(`Slide ${i}`, {
            x: 1,
            y: 0.5,
            w: 8,
            h: 1,
            fontSize: 32,
            bold: true,
            color: templateStyles.headerColor
          });
          
          slide.addText("Content goes here...", {
            x: 1,
            y: 2,
            w: 8,
            h: 4,
            fontSize: 16,
            color: templateStyles.contentColor
          });
        }
        
        // Ensure output directory exists
        const outputDir = path.dirname(outputPath);
        if (!fs.existsSync(outputDir)) {
          fs.mkdirSync(outputDir, { recursive: true });
        }
        
        // Save presentation
        await pres.writeFile({ fileName: outputPath });
        
        return {
          content: [{
            type: "text",
            text: `✅ **Presentation Created Successfully**\n\n` +
                  `📄 **Title:** ${args.title}\n` +
                  `📊 **Slides:** ${slideCount}\n` +
                  `🎨 **Template:** ${template}\n` +
                  `📁 **Output:** ${outputPath}\n\n` +
                  `The presentation has been saved and is ready to use!`
          }]
        };
        
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: `❌ **Failed to create presentation:** ${error instanceof Error ? error.message : String(error)}`
          }],
          isError: true
        };
      }
    }
  • JSON schema defining input parameters for the create_presentation tool including title (required), slides, output_path, and template.
    parameters: {
      type: "object",
      properties: {
        title: {
          type: "string",
          description: "Title of the presentation"
        },
        slides: {
          type: "number",
          description: "Number of slides to create (default: 1)",
          default: 1
        },
        output_path: {
          type: "string",
          description: "Output file path (optional, defaults to current directory)"
        },
        template: {
          type: "string",
          description: "Presentation template style",
          enum: ["basic", "professional", "modern"],
          default: "basic"
        }
      },
      required: ["title"]
    },
  • src/index.ts:57-74 (registration)
    Registers the tool handler dispatch in MCP server for call_tool requests, mapping 'create_presentation' to pptCreator.run().
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      switch (request.params.name) {
        case "create_presentation":
          return await pptCreator.run(request.params.arguments as any || {});
        case "edit_presentation":
          return await pptEditor.run(request.params.arguments as any || {});
        case "read_presentation":
          return await pptReader.run(request.params.arguments as any || {});
        case "analyze_presentation":
          return await pptAnalyzer.run(request.params.arguments as any || {});
        case "edit_presentation_enhanced":
          return await pptEditorEnhanced.run(request.params.arguments as any || {});
        case "edit_presentation_advanced":
          return await pptEditorAdvanced.run(request.params.arguments as any || {});
        default:
          throw new Error(`Unknown tool: ${request.params.name}`);
      }
    });
  • src/index.ts:19-53 (registration)
    Registers the tool metadata (name, description, schema) for list_tools requests in MCP server.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: pptCreator.name,
            description: pptCreator.description,
            inputSchema: pptCreator.parameters
          },
          {
            name: pptEditor.name,
            description: pptEditor.description,
            inputSchema: pptEditor.parameters
          },
          {
            name: pptReader.name,
            description: pptReader.description,
            inputSchema: pptReader.parameters
          },
          {
            name: pptAnalyzer.name,
            description: pptAnalyzer.description,
            inputSchema: pptAnalyzer.parameters
          },
          {
            name: pptEditorEnhanced.name,
            description: pptEditorEnhanced.description,
            inputSchema: pptEditorEnhanced.parameters
          },
          {
            name: pptEditorAdvanced.name,
            description: pptEditorAdvanced.description,
            inputSchema: pptEditorAdvanced.parameters
          }
        ]
      };
  • Helper function providing color styles for different presentation templates used in the handler.
    function getTemplateStyles(template: string) {
      switch (template) {
        case "professional":
          return {
            titleColor: "2F4F4F",
            subtitleColor: "696969",
            headerColor: "2F4F4F",
            contentColor: "000000"
          };
        case "modern":
          return {
            titleColor: "4A90E2",
            subtitleColor: "7ED321",
            headerColor: "4A90E2",
            contentColor: "333333"
          };
        default: // basic
          return {
            titleColor: "000000",
            subtitleColor: "666666",
            headerColor: "000000",
            contentColor: "333333"
          };
      }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/guangxiangdebizi/PPT-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server