@ourroadmaps/mcp 0.25.0 → 0.25.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/dist/index.js +84 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1301,6 +1301,13 @@ class ApiClient {
|
|
|
1301
1301
|
body: JSON.stringify({ items })
|
|
1302
1302
|
});
|
|
1303
1303
|
}
|
|
1304
|
+
async getSlideUploadUrl(presentationId, variantId, data) {
|
|
1305
|
+
const response = await this.request(`/v1/presentations/${presentationId}/variants/${variantId}/slides/upload-url`, {
|
|
1306
|
+
method: "POST",
|
|
1307
|
+
body: JSON.stringify(data)
|
|
1308
|
+
});
|
|
1309
|
+
return response.data;
|
|
1310
|
+
}
|
|
1304
1311
|
async getVariantPresentationId(variantId) {
|
|
1305
1312
|
const presentations = await this.listPresentations();
|
|
1306
1313
|
for (const presentation2 of presentations.items) {
|
|
@@ -1421,6 +1428,7 @@ function registerAllTools(server) {
|
|
|
1421
1428
|
registerUpdateSlide(server);
|
|
1422
1429
|
registerDeleteSlide(server);
|
|
1423
1430
|
registerReorderSlides(server);
|
|
1431
|
+
registerUploadSlideImage(server);
|
|
1424
1432
|
}
|
|
1425
1433
|
function registerGetWorkflows(server) {
|
|
1426
1434
|
server.registerTool("get_workflows", {
|
|
@@ -4465,6 +4473,82 @@ function registerReorderSlides(server) {
|
|
|
4465
4473
|
};
|
|
4466
4474
|
});
|
|
4467
4475
|
}
|
|
4476
|
+
function registerUploadSlideImage(server) {
|
|
4477
|
+
server.registerTool("upload_slide_image", {
|
|
4478
|
+
description: 'Upload an image to a slide. Gets a presigned URL and returns a curl command to execute for the upload, then updates the slide content with the image URL. The slide must be of type "image".',
|
|
4479
|
+
inputSchema: {
|
|
4480
|
+
variantId: z15.string().describe("The UUID of the variant"),
|
|
4481
|
+
slideId: z15.string().describe("The UUID of the slide to add the image to"),
|
|
4482
|
+
filePath: z15.string().describe("Absolute path to the image file on disk")
|
|
4483
|
+
}
|
|
4484
|
+
}, async ({
|
|
4485
|
+
variantId,
|
|
4486
|
+
slideId,
|
|
4487
|
+
filePath
|
|
4488
|
+
}) => {
|
|
4489
|
+
const client2 = getApiClient();
|
|
4490
|
+
const presentationId = await client2.getVariantPresentationId(variantId);
|
|
4491
|
+
if (!presentationId) {
|
|
4492
|
+
return {
|
|
4493
|
+
content: [
|
|
4494
|
+
{
|
|
4495
|
+
type: "text",
|
|
4496
|
+
text: JSON.stringify({ error: "Variant not found" }, null, 2)
|
|
4497
|
+
}
|
|
4498
|
+
]
|
|
4499
|
+
};
|
|
4500
|
+
}
|
|
4501
|
+
const filename = filePath.split("/").pop() || "image.png";
|
|
4502
|
+
const contentType = inferContentType(filename);
|
|
4503
|
+
if (!contentType || !contentType.startsWith("image/")) {
|
|
4504
|
+
return {
|
|
4505
|
+
content: [
|
|
4506
|
+
{
|
|
4507
|
+
type: "text",
|
|
4508
|
+
text: JSON.stringify({
|
|
4509
|
+
error: "Invalid file type. Slide images only accept image files (png, jpeg, gif, webp)."
|
|
4510
|
+
})
|
|
4511
|
+
}
|
|
4512
|
+
]
|
|
4513
|
+
};
|
|
4514
|
+
}
|
|
4515
|
+
const slide2 = await client2.getSlide(presentationId, variantId, slideId);
|
|
4516
|
+
if (slide2.slideType !== "image") {
|
|
4517
|
+
return {
|
|
4518
|
+
content: [
|
|
4519
|
+
{
|
|
4520
|
+
type: "text",
|
|
4521
|
+
text: JSON.stringify({
|
|
4522
|
+
error: `Slide is type "${slide2.slideType}", not "image". Only image slides support image upload.`
|
|
4523
|
+
})
|
|
4524
|
+
}
|
|
4525
|
+
]
|
|
4526
|
+
};
|
|
4527
|
+
}
|
|
4528
|
+
const { uploadUrl, imageUrl } = await client2.getSlideUploadUrl(presentationId, variantId, {
|
|
4529
|
+
filename,
|
|
4530
|
+
contentType
|
|
4531
|
+
});
|
|
4532
|
+
const existingContent = slide2.content || {};
|
|
4533
|
+
await client2.updateSlide(presentationId, variantId, slideId, {
|
|
4534
|
+
content: { ...existingContent, imageUrl }
|
|
4535
|
+
});
|
|
4536
|
+
const curlCommand = `curl -X PUT -H "Content-Type: ${contentType}" --data-binary @"${filePath}" "${uploadUrl}"`;
|
|
4537
|
+
return {
|
|
4538
|
+
content: [
|
|
4539
|
+
{
|
|
4540
|
+
type: "text",
|
|
4541
|
+
text: JSON.stringify({
|
|
4542
|
+
slideId,
|
|
4543
|
+
imageUrl,
|
|
4544
|
+
curlCommand,
|
|
4545
|
+
instructions: "Execute the curlCommand to upload the file. The slide has been updated and will display the image once uploaded."
|
|
4546
|
+
}, null, 2)
|
|
4547
|
+
}
|
|
4548
|
+
]
|
|
4549
|
+
};
|
|
4550
|
+
});
|
|
4551
|
+
}
|
|
4468
4552
|
|
|
4469
4553
|
// src/index.ts
|
|
4470
4554
|
async function main() {
|