@jieunmarslim/server-editable-slides 0.1.0 → 0.1.1
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 +28 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -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.instructionsForAgent =
|
|
190
|
+
'The presentation file has been generated. ' +
|
|
191
|
+
'To open this as a live Google Slides link in the user\'s Google Drive: ' +
|
|
192
|
+
'use the Google Drive MCP tool (e.g. drive.uploadFile or gws-drive) to upload the .pptx file ' +
|
|
193
|
+
'with mimeType="application/vnd.google-apps.presentation" (or convert=true). ' +
|
|
194
|
+
'This will convert it into a native Google Slides presentation inside the user\'s Drive and provide the editable link.';
|
|
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
|
);
|