@atray/mcp 1.0.5 → 1.0.6
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/package.json +1 -1
- package/src/index.js +5 -3
- package/src/tools.js +5 -4
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { tools } from './tools.js';
|
|
|
10
10
|
import { api } from './api.js';
|
|
11
11
|
|
|
12
12
|
const server = new Server(
|
|
13
|
-
{ name: 'atray-mcp', version: '1.0.
|
|
13
|
+
{ name: 'atray-mcp', version: '1.0.6' },
|
|
14
14
|
{ capabilities: { tools: {} } }
|
|
15
15
|
);
|
|
16
16
|
|
|
@@ -103,7 +103,7 @@ async function callTool(name, a) {
|
|
|
103
103
|
|
|
104
104
|
const IMAGE_MIME = { jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png', webp: 'image/webp' };
|
|
105
105
|
|
|
106
|
-
async function uploadPostImage({ id, file_path, image_url }) {
|
|
106
|
+
async function uploadPostImage({ id, file_path, image_url, slot_index }) {
|
|
107
107
|
if (!id) throw new Error('id (post UUID) is required');
|
|
108
108
|
if (!file_path && !image_url) throw new Error('Provide file_path (local file) or image_url (public URL)');
|
|
109
109
|
|
|
@@ -129,7 +129,9 @@ async function uploadPostImage({ id, file_path, image_url }) {
|
|
|
129
129
|
|
|
130
130
|
const base64 = buffer.toString('base64');
|
|
131
131
|
const ext = m[1] === 'jpg' ? 'jpeg' : m[1];
|
|
132
|
-
|
|
132
|
+
const body = { image: `data:image/${ext};base64,${base64}`, filename };
|
|
133
|
+
if (slot_index != null) body.slot_index = Number(slot_index);
|
|
134
|
+
return api.post(`/posts/${id}/image`, body);
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
const VIDEO_MIME = { mp4: 'video/mp4', mov: 'video/quicktime', webm: 'video/webm' };
|
package/src/tools.js
CHANGED
|
@@ -228,14 +228,15 @@ export const tools = [
|
|
|
228
228
|
|
|
229
229
|
{
|
|
230
230
|
name: 'uploadPostImage',
|
|
231
|
-
description: 'Uploads a custom image (jpg, jpeg, png or webp) as the post media, replacing the current AI-generated image. Provide either file_path (local file) or image_url (public URL to download from).',
|
|
231
|
+
description: 'Uploads a custom image (jpg, jpeg, png or webp) as the post media, replacing the current AI-generated image. Provide either file_path (local file) or image_url (public URL to download from). For carousel posts, use slot_index (0-based) to target a specific slide; omit to replace slide 0.',
|
|
232
232
|
inputSchema: {
|
|
233
233
|
type: 'object',
|
|
234
234
|
required: ['id'],
|
|
235
235
|
properties: {
|
|
236
|
-
id:
|
|
237
|
-
file_path:
|
|
238
|
-
image_url:
|
|
236
|
+
id: { type: 'string', description: 'Post UUID' },
|
|
237
|
+
file_path: { type: 'string', description: 'Absolute path to a local image file (jpg, jpeg, png, webp)' },
|
|
238
|
+
image_url: { type: 'string', description: 'Public URL of the image to download and upload' },
|
|
239
|
+
slot_index: { type: 'number', description: 'Carousel slide index (0-based). Required to fill slides beyond the first one.' },
|
|
239
240
|
},
|
|
240
241
|
},
|
|
241
242
|
},
|