@jieunmarslim/server-editable-slides 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +29 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -89,7 +89,7 @@ const server = new McpServer({
|
|
|
89
89
|
|
|
90
90
|
server.tool(
|
|
91
91
|
'create_slides_from_image',
|
|
92
|
-
'Convert a presentation slide image or PDF into an editable
|
|
92
|
+
'Convert a presentation slide image or PDF into an editable presentation deck. Reads local files, securely processes via Editable Slides Cloud, and returns the presentation. DO NOT write code or install packages to convert files; present the output directly or use existing Google Drive MCP tools if already available.',
|
|
93
93
|
{
|
|
94
94
|
filePath: z
|
|
95
95
|
.string()
|
|
@@ -170,6 +170,34 @@ server.tool(
|
|
|
170
170
|
apiKey,
|
|
171
171
|
);
|
|
172
172
|
|
|
173
|
+
// If a PPTX download URL was returned and the caller used a local filePath,
|
|
174
|
+
// automatically download the .pptx directly to the local disk and guide the
|
|
175
|
+
// agent to use Google Drive MCP to convert it into a live Google Slide.
|
|
176
|
+
try {
|
|
177
|
+
const parsed = JSON.parse(result.content[0].text);
|
|
178
|
+
if (parsed.downloadUrl && filePath) {
|
|
179
|
+
const localPptxPath = filePath.replace(/\.[^/.]+$/, '') + '.pptx';
|
|
180
|
+
console.error(`[EditableSlides] Saving PowerPoint file to "${localPptxPath}"...`);
|
|
181
|
+
const pptxRes = await fetch(parsed.downloadUrl);
|
|
182
|
+
if (pptxRes.ok) {
|
|
183
|
+
const buf = Buffer.from(await pptxRes.arrayBuffer());
|
|
184
|
+
await fs.promises.writeFile(localPptxPath, buf);
|
|
185
|
+
parsed.localPptxPath = localPptxPath;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (parsed.downloadUrl || parsed.localPptxPath) {
|
|
189
|
+
parsed.agentInstructions = [
|
|
190
|
+
'TASK FINISHED: The presentation has been successfully generated and saved as an editable PowerPoint (.pptx) file.',
|
|
191
|
+
'STRICT MANDATE FOR AGENT: DO NOT write custom scripts, install Python/Node packages, or execute terminal commands to convert or upload this file.',
|
|
192
|
+
'1. If you already have an active Google Drive MCP tool (e.g. drive.uploadFile or gws-drive) available in your toolset, you may call it to upload the .pptx file with Google Slides conversion.',
|
|
193
|
+
'2. If you DO NOT have a Google Drive MCP tool in your toolset, simply present the generated presentation (local path / download URL) to the user and inform them: "To open this as a live Google Slides link in your Drive, please add the Google Drive MCP (`agy mcp add google-drive ...`) or drag the .pptx file into Google Drive."',
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
result.content[0].text = JSON.stringify(parsed, null, 2);
|
|
197
|
+
} catch {
|
|
198
|
+
// Keep original result text if parsing failed
|
|
199
|
+
}
|
|
200
|
+
|
|
173
201
|
return result;
|
|
174
202
|
},
|
|
175
203
|
);
|