@mixio-pro/kalaasetu-mcp 1.0.12 → 1.0.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mixio-pro/kalaasetu-mcp",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "A powerful Model Context Protocol server providing AI tools for content generation and analysis",
5
5
  "type": "module",
6
6
  "module": "src/index.ts",
@@ -1,4 +1,3 @@
1
- import * as fs from "fs";
2
1
  import { GoogleAuth } from "google-auth-library";
3
2
  import { exec } from "child_process";
4
3
  import * as path from "path";
@@ -99,7 +98,9 @@ export const imageToVideo = {
99
98
  duration_seconds: z
100
99
  .string()
101
100
  .optional()
102
- .describe("Video duration in seconds: '4', '6', or '8' (default: '6')"),
101
+ .describe(
102
+ "Video duration in seconds. MUST be one of: '4', '6', or '8' (default: '6'). Other values will be rejected by Vertex AI."
103
+ ),
103
104
  resolution: z
104
105
  .string()
105
106
  .optional()
@@ -164,6 +165,32 @@ export const imageToVideo = {
164
165
  const location = args.location_id || "us-central1";
165
166
  const modelId = args.model_id || "veo-3.1-fast-generate-preview";
166
167
 
168
+ // Validate and parse duration_seconds - snap to nearest 4, 6, or 8
169
+ let durationSeconds = parseInt(args.duration_seconds || "6");
170
+ if (isNaN(durationSeconds)) durationSeconds = 6;
171
+
172
+ const validDurations = [4, 6, 8];
173
+ // Find nearest valid duration
174
+ durationSeconds = validDurations.reduce((prev, curr) => {
175
+ return Math.abs(curr - durationSeconds) < Math.abs(prev - durationSeconds)
176
+ ? curr
177
+ : prev;
178
+ });
179
+
180
+ // Tie-breaking: if equidistant (e.g. 5), the reduce above keeps the first one (4) because < is strict.
181
+ // However, user requested "nearest duration with the ceil", effectively meaning round up if equidistant.
182
+ // Let's explicitly handle the equidistant cases or just use a custom finder.
183
+ // 5 -> equidistant to 4 and 6. "With ceil" implies 6.
184
+ // 7 -> equidistant to 6 and 8. "With ceil" implies 8.
185
+
186
+ // Simpler logic for these specific values:
187
+ if (durationSeconds === 4 && parseInt(args.duration_seconds || "6") === 5) {
188
+ durationSeconds = 6;
189
+ }
190
+ if (durationSeconds === 6 && parseInt(args.duration_seconds || "6") === 7) {
191
+ durationSeconds = 8;
192
+ }
193
+
167
194
  const token = await fetchAccessToken();
168
195
 
169
196
  const url = `https://${location}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${location}/publishers/google/models/${modelId}:predictLongRunning`;
@@ -242,7 +269,7 @@ export const imageToVideo = {
242
269
 
243
270
  const parameters: any = {
244
271
  aspectRatio: args.aspect_ratio || "9:16",
245
- durationSeconds: parseInt(args.duration_seconds || "6") || 6,
272
+ durationSeconds: durationSeconds,
246
273
  resolution: args.resolution || "720p",
247
274
  negativePrompt: args.negative_prompt,
248
275
  generateAudio: args.generate_audio || false,
@@ -302,14 +329,15 @@ export const imageToVideo = {
302
329
  [];
303
330
  const saveVideo = async (base64: string, index: number) => {
304
331
  if (!base64) return;
305
-
332
+
306
333
  // Use provided output path or generate default with timestamp
307
334
  let filePath: string;
308
335
  if (args.output_path) {
309
336
  // User provided path - use as-is for first video, add index for subsequent
310
- filePath = index === 0
311
- ? args.output_path
312
- : args.output_path.replace(/\.mp4$/i, `_${index}.mp4`);
337
+ filePath =
338
+ index === 0
339
+ ? args.output_path
340
+ : args.output_path.replace(/\.mp4$/i, `_${index}.mp4`);
313
341
  } else {
314
342
  // No path provided - generate timestamped default
315
343
  const defaultName = `video_output${index > 0 ? `_${index}` : ""}.mp4`;