Skip to main content
Glama

generate_powerpoint_presentation

Create PowerPoint presentations with custom slides, charts, and themes using Microsoft 365 data. Generate professional slides, add visual elements, and apply branding templates.

Instructions

Create professional PowerPoint presentations with custom slides, charts, tables, and themes from Microsoft 365 data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform: create new presentation, get existing, list all, or export to format
fileNameNoName for the new presentation file (for create action)
driveIdNoOneDrive/SharePoint drive ID where file should be created (default: user's OneDrive)
folderIdNoFolder ID within the drive (default: root)
templateNoTemplate configuration for presentation styling
slidesNoArray of slide definitions to create
fileIdNoFile ID for get/export actions
formatNoExport format (for export action)
filterNoOData filter for list action
topNoNumber of results to return (for list action)

Implementation Reference

  • Primary handler function that dispatches PowerPoint operations based on action (create, get, list, export). Calls createPresentation for generation.
    export async function handlePowerPointPresentations( args: PowerPointPresentationArgs, graphClient: Client ): Promise<string> { try { switch (args.action) { case 'create': return await createPresentation(args, graphClient); case 'get': return await getPresentation(args, graphClient); case 'list': return await listPresentations(args, graphClient); case 'export': return await exportPresentation(args, graphClient); default: throw new McpError( ErrorCode.InvalidRequest, `Unknown action: ${args.action}` ); } } catch (error) { if (error instanceof McpError) throw error; throw new McpError( ErrorCode.InternalError, `PowerPoint operation failed: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • Zod input schema defining parameters for the generate_powerpoint_presentation tool, including action, slides, template, etc.
    export const powerPointPresentationArgsSchema = z.object({ action: z.enum(['create', 'get', 'list', 'export']) .describe('Action to perform: create new presentation, get existing, list all, or export to format'), fileName: z.string().optional() .describe('Name for the new presentation file (for create action)'), driveId: z.string().optional() .describe('OneDrive/SharePoint drive ID where file should be created (default: user\'s OneDrive)'), folderId: z.string().optional() .describe('Folder ID within the drive (default: root)'), template: powerPointTemplateSchema.optional() .describe('Template configuration for presentation styling'), slides: z.array(powerPointSlideSchema).optional() .describe('Array of slide definitions to create'), fileId: z.string().optional() .describe('File ID for get/export actions'), format: z.enum(['pptx', 'pdf', 'odp']).optional() .describe('Export format (for export action)'), filter: z.string().optional() .describe('OData filter for list action'), top: z.number().optional() .describe('Number of results to return (for list action)') });
  • MCP server tool registration binding the tool name to handlePowerPointPresentations handler and powerPointPresentationArgsSchema.
    "generate_powerpoint_presentation", "Create professional PowerPoint presentations with custom slides, charts, tables, and themes from Microsoft 365 data.", powerPointPresentationArgsSchema.shape, {"readOnlyHint":false,"destructiveHint":false,"idempotentHint":false}, wrapToolHandler(async (args: PowerPointPresentationArgs) => { this.validateCredentials(); try { const result = await handlePowerPointPresentations(args, this.getGraphClient()); return { content: [{ type: 'text', text: result }] }; } catch (error) { if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Error generating PowerPoint presentation: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }) );
  • Tool metadata including description, title, and annotations used for tool discovery and UI hints.
    generate_powerpoint_presentation: { description: "Create professional PowerPoint presentations with custom slides, charts, tables, and themes from Microsoft 365 data.", title: "PowerPoint Generator", annotations: { title: "PowerPoint Generator", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true } },
  • Core creation logic that generates PPTX content via generatePresentationXML and uploads to OneDrive/SharePoint.
    async function createPresentation( args: PowerPointPresentationArgs, graphClient: Client ): Promise<string> { if (!args.fileName) { throw new McpError(ErrorCode.InvalidRequest, 'fileName is required for create action'); } if (!args.slides || args.slides.length === 0) { throw new McpError(ErrorCode.InvalidRequest, 'At least one slide is required'); } // Determine drive location (default to user's OneDrive) const driveId = args.driveId || 'me'; const folderPath = args.folderId ? `/items/${args.folderId}` : '/root'; // Create empty PowerPoint file const fileName = args.fileName.endsWith('.pptx') ? args.fileName : `${args.fileName}.pptx`; // Create file with content const presentationContent = generatePresentationXML(args.slides, args.template); const uploadedFile = await graphClient .api(`/drives/${driveId}${folderPath}:/${fileName}:/content`) .header('Content-Type', 'application/vnd.openxmlformats-officedocument.presentationml.presentation') .put(presentationContent); return JSON.stringify({ success: true, fileId: uploadedFile.id, fileName: uploadedFile.name, webUrl: uploadedFile.webUrl, driveId: uploadedFile.parentReference?.driveId, message: `PowerPoint presentation "${fileName}" created successfully with ${args.slides.length} slides` }, null, 2); }

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/DynamicEndpoints/m365-core-mcp'

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