read_presentation
Extract text, JSON, or markdown content from PowerPoint presentations, including optional slide ranges and speaker notes for analysis and processing.
Instructions
Read and extract content from PowerPoint presentations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Path to the PowerPoint file to read | |
| include_notes | No | Whether to include speaker notes | |
| output_format | No | Output format for the content | text |
| slide_range | No | Range of slides to read (optional) |
Implementation Reference
- src/tools/ppt-reader.ts:37-86 (handler)The async run() method implementing the core tool execution logic, which validates the file path, checks existence, and returns file metadata with a note on reading limitations due to PptxGenJS.async run(args: { file_path: string; output_format?: string; slide_range?: { start?: number; end?: number }; include_notes?: boolean }) { try { // Parameter validation if (!args.file_path) { throw new Error("File path is required"); } if (!fs.existsSync(args.file_path)) { throw new Error(`File not found: ${args.file_path}`); } // Note: PptxGenJS doesn't support reading existing PowerPoint files // This is a limitation of the library - it's primarily for creation, not reading // For reading PPT files, we'd need a different library like 'officegen' or 'node-pptx' const fileStats = fs.statSync(args.file_path); const fileName = path.basename(args.file_path); const fileSize = (fileStats.size / 1024).toFixed(2); // KB return { content: [{ type: "text", text: `⚠️ **Read Operation Not Fully Supported**\n\n` + `Unfortunately, PptxGenJS doesn't support reading existing PowerPoint files. ` + `This is a current limitation of the library.\n\n` + `**File Information:**\n` + `📄 **Name:** ${fileName}\n` + `📁 **Path:** ${args.file_path}\n` + `📊 **Size:** ${fileSize} KB\n` + `📅 **Modified:** ${fileStats.mtime.toLocaleString()}\n\n` + `**Alternative approaches:**\n` + `• Use Microsoft PowerPoint to view the content\n` + `• Convert to PDF and use PDF reading tools\n` + `• Use online PowerPoint viewers\n` + `• Consider using a different library like 'mammoth' for basic text extraction\n\n` + `**Requested format:** ${args.output_format || 'text'}\n` + `**Include notes:** ${args.include_notes ? 'Yes' : 'No'}` }] }; } catch (error) { return { content: [{ type: "text", text: `❌ **Failed to read presentation:** ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
- src/tools/ppt-reader.ts:7-35 (schema)JSON schema defining the input parameters for the read_presentation tool, including file_path (required), output_format, slide_range, and include_notes.parameters: { type: "object", properties: { file_path: { type: "string", description: "Path to the PowerPoint file to read" }, output_format: { type: "string", description: "Output format for the content", enum: ["text", "json", "markdown"], default: "text" }, slide_range: { type: "object", description: "Range of slides to read (optional)", properties: { start: { type: "number", description: "Start slide number (1-based)" }, end: { type: "number", description: "End slide number (1-based)" } } }, include_notes: { type: "boolean", description: "Whether to include speaker notes", default: false } }, required: ["file_path"] },
- src/index.ts:32-36 (registration)Registration of the read_presentation tool in the ListToolsRequestSchema handler, exposing name, description, and input schema.{ name: pptReader.name, description: pptReader.description, inputSchema: pptReader.parameters },
- src/index.ts:63-64 (registration)Registration in the CallToolRequestSchema switch statement, dispatching tool calls to pptReader.run().case "read_presentation": return await pptReader.run(request.params.arguments as any || {});