freebeat-mcp 0.1.1 → 0.1.4

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +115 -3
  3. package/dist/capabilities/media/register.d.ts +3 -0
  4. package/dist/capabilities/media/register.js +13 -0
  5. package/dist/capabilities/media/register.js.map +1 -0
  6. package/dist/capabilities/media/tools/edit-image.d.ts +3 -0
  7. package/dist/capabilities/media/tools/edit-image.js +78 -0
  8. package/dist/capabilities/media/tools/edit-image.js.map +1 -0
  9. package/dist/capabilities/media/tools/generate-image.d.ts +3 -0
  10. package/dist/capabilities/media/tools/generate-image.js +73 -0
  11. package/dist/capabilities/media/tools/generate-image.js.map +1 -0
  12. package/dist/capabilities/media/tools/generate-video.d.ts +3 -0
  13. package/dist/capabilities/media/tools/generate-video.js +124 -0
  14. package/dist/capabilities/media/tools/generate-video.js.map +1 -0
  15. package/dist/capabilities/media/tools/get-model-help.d.ts +2 -0
  16. package/dist/capabilities/media/tools/get-model-help.js +26 -0
  17. package/dist/capabilities/media/tools/get-model-help.js.map +1 -0
  18. package/dist/capabilities/media/tools/list-models.d.ts +2 -0
  19. package/dist/capabilities/media/tools/list-models.js +32 -0
  20. package/dist/capabilities/media/tools/list-models.js.map +1 -0
  21. package/dist/capabilities/media/tools/shared.d.ts +42 -0
  22. package/dist/capabilities/media/tools/shared.js +79 -0
  23. package/dist/capabilities/media/tools/shared.js.map +1 -0
  24. package/dist/capabilities/tasks/tools/get-task-status.d.ts +1 -1
  25. package/dist/capabilities/tasks/tools/get-task-status.js +78 -2
  26. package/dist/capabilities/tasks/tools/get-task-status.js.map +1 -1
  27. package/dist/core/model-catalog.d.ts +82 -0
  28. package/dist/core/model-catalog.js +861 -0
  29. package/dist/core/model-catalog.js.map +1 -0
  30. package/dist/index.js +2 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/services/freebeat-api.d.ts +138 -0
  33. package/dist/services/freebeat-api.js +112 -0
  34. package/dist/services/freebeat-api.js.map +1 -1
  35. package/dist/utils/file.d.ts +1 -0
  36. package/dist/utils/file.js +55 -0
  37. package/dist/utils/file.js.map +1 -1
  38. package/package.json +3 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on Keep a Changelog, and this project follows Semantic Versioning.
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.4] - 2026-07-10
10
+
11
+ ### Added
12
+ - Synced Open RPC generative media support with `freebeat-cli`: expanded model catalog, explicit image options, Qwen edit defaults, video generation modes, watermark, style, and multi-clip controls.
13
+ - Synced GPT-Image 1.5 pricing compatibility defaults: model `70` now sends `quality=medium` and `resolution=1024x1024` for image generation and editing when omitted.
14
+ - Synced latest CLI media catalog constraints: GPT-Image 1.5 resolution allowlist, no `kling-o3-pro` reference mode, and temporarily hidden `wan-v2.6-video`.
15
+
16
+ ## [0.1.3] - 2026-06-18
17
+
18
+ ### Added
19
+ - Added Open RPC model discovery with `list_models` and `get_model_help`.
20
+ - Added image generation, single-image editing, and text-to-video MCP tools.
21
+ - Added Open RPC batch status support through `get_task_status`.
22
+
23
+ ### Changed
24
+ - Documented image/video generation workflows and batch result handling in the README.
package/README.md CHANGED
@@ -4,7 +4,7 @@ MCP server for Freebeat creative workflows.
4
4
 
5
5
  Use it from MCP clients such as Claude Desktop and Cursor through `npx freebeat-mcp`.
6
6
 
7
- It currently supports audio and image upload, effect template discovery, AI effect generation, AI music video generation, and async task polling.
7
+ It currently supports audio and image upload, effect template discovery, AI effect generation, AI music video generation, Open RPC image/video generation, model discovery, and async task polling.
8
8
 
9
9
  ## Features
10
10
 
@@ -13,6 +13,9 @@ It currently supports audio and image upload, effect template discovery, AI effe
13
13
  - Supported effect template listing
14
14
  - AI effect generation
15
15
  - AI music video generation
16
+ - Supported image and video model discovery
17
+ - AI image generation and single-image editing
18
+ - AI text-to-video generation
16
19
  - Generic task polling and result retrieval
17
20
 
18
21
  ## Installation
@@ -176,11 +179,119 @@ Returns a task envelope with:
176
179
  - `task_type` currently `music_video_generation`
177
180
  - `status`
178
181
 
182
+ ### `list_models`
183
+
184
+ List supported Open RPC models for either `image` or `video`.
185
+
186
+ Recommended flow:
187
+
188
+ - `list_models` with `type: "image"` before `generate_image` or `edit_image`
189
+ - `list_models` with `type: "video"` before `generate_video`
190
+ - optional `get_model_help` for model-specific examples and constraints
191
+
192
+ Each model entry includes:
193
+
194
+ - `model_id`
195
+ - `model`, the API model key when one is available
196
+ - `display_name`
197
+ - `commands`
198
+ - `constraints`
199
+
200
+ ### `get_model_help`
201
+
202
+ Show detailed usage guidance for one Open RPC model.
203
+
204
+ Parameters:
205
+
206
+ - `model` required, using either a numeric `model_id` or API model key from `list_models`
207
+
208
+ Use this before video generation to confirm required `duration`, `resolution`, supported `aspect_ratio`, and whether `generate_audio` is supported.
209
+ For video models, help also lists supported generation modes (`text`, `image`, `transition`, `reference`) and duration values by resolution when the local catalog has that detail.
210
+
211
+ ### `generate_image`
212
+
213
+ Create an async Open RPC image generation batch.
214
+
215
+ Recommended flow:
216
+
217
+ - `list_models` with `type: "image"`
218
+ - optional `get_model_help`
219
+ - `generate_image`
220
+ - `get_task_status` with the returned `batch_id`
221
+
222
+ Parameters:
223
+
224
+ - `model` required, from `list_models`
225
+ - `prompt` required, trimmed length must be `1` to `2000`
226
+ - `size` optional
227
+ - `resolution` optional
228
+ - `quality` optional
229
+ - `output_format` optional, for supported models such as `png`, `jpeg`, or `webp`
230
+ - `custom_resolution` optional, only accepted for models that support custom pixel dimensions
231
+ - `count` optional, default `1`
232
+
233
+ For GPT-Image 1.5 (`model_id` `70`) and GPT-Image 2 (`model_id` `108`), the MCP server sends `quality: "medium"` and `resolution: "1024x1024"` by default when omitted. GPT-Image 1.5 currently accepts `resolution` values `1024x1024`, `1536x1024`, and `1024x1536`; GPT-Image 2 exposes its broader list through `get_model_help`. If `resolution` is omitted but `size` is provided, that `size` is also sent as `resolution` for compatibility.
234
+
235
+ ### `edit_image`
236
+
237
+ Create an async Open RPC single-image edit batch.
238
+
239
+ Recommended flow:
240
+
241
+ - `upload_image` or provide an existing image URL
242
+ - `list_models` with `type: "image"`
243
+ - optional `get_model_help`
244
+ - `edit_image`
245
+ - `get_task_status` with the returned `batch_id`
246
+
247
+ Parameters:
248
+
249
+ - `model` required, from `list_models`
250
+ - `image` required, a single image URL
251
+ - `prompt` required, trimmed length must be `1` to `2000`
252
+ - `size` optional
253
+ - `resolution` optional
254
+ - `quality` optional
255
+ - `output_format` optional
256
+ - `custom_resolution` optional
257
+ - `count` optional, default `1`
258
+
259
+ For Qwen Image Edit (`model_id` `76`), the MCP server sends `quality: "medium"`, `resolution: "1024x1024"`, and `customResolution: 1` by default for pricing compatibility.
260
+
261
+ ### `generate_video`
262
+
263
+ Create an async Open RPC video generation batch.
264
+
265
+ Recommended flow:
266
+
267
+ - `list_models` with `type: "video"`
268
+ - `get_model_help`
269
+ - `generate_video`
270
+ - `get_task_status` with the returned `batch_id`
271
+
272
+ Parameters:
273
+
274
+ - `model` required, from `list_models`
275
+ - `prompt` required, trimmed length must be `1` to `2000`
276
+ - `generation_type` optional, default `text`; supported values are `text`, `image`, `transition`, and `reference`
277
+ - `images` required for non-text modes: exactly one for `image`, exactly two for `transition`, at least one for `reference`; entries may be image URLs or local image paths
278
+ - `duration` required when the selected model declares supported durations
279
+ - `resolution` required when the selected model declares supported resolutions
280
+ - `aspect_ratio` optional, validated when the selected model declares supported ratios
281
+ - `style` optional, only accepted for models that declare styles
282
+ - `generate_audio` optional, only accepted for models that support generated audio
283
+ - `multi_clip` optional, only accepted for models that support multi-clip generation
284
+ - `watermark` optional, default `false`; Open RPC video requests send `watermark: 0` unless set
285
+
286
+ Video model constraints are validated locally before a request is sent. Local images used for video generation must be at least `300x300` and are uploaded automatically. `wan-v2.6-video` is not exposed until its downstream reference image mapping is fixed; `kling-o3-pro` currently exposes `text`, `image`, and `transition`, but not `reference`.
287
+
179
288
  ### `get_task_status`
180
289
 
181
- Poll a Freebeat async task until it reaches a terminal status. Current MCP endpoints return lowercase status values such as `pending`, `completed`, and `failed`; older backends may still return uppercase variants.
290
+ Poll a Freebeat async task or Open RPC batch until it reaches a terminal status. Current MCP endpoints return lowercase status values such as `pending`, `completed`, and `failed`; older backends may still return uppercase variants.
291
+
292
+ For legacy MV/effect tasks, continue polling while the status is still in progress. Only call `get_task_result` after the status is `completed`.
182
293
 
183
- Continue polling while the status is still in progress. Only call `get_task_result` after the status is `completed`.
294
+ For Open RPC image/video batches, pass the returned `batch_id` as `task_id`. You can also pass `serial_no` to query a single batch item. Completed batch items include result URLs directly in `get_task_status`, so `get_task_result` is not used for Open RPC batches.
184
295
 
185
296
  Returns a stable task envelope including:
186
297
 
@@ -190,6 +301,7 @@ Returns a stable task envelope including:
190
301
  - `error_message` optional, present when backend reports a failed task
191
302
  - `error_code` optional, present when backend reports a failed task
192
303
  - `message` optional, present when status is `completed` or `failed`
304
+ - `items` optional, present for Open RPC batches and containing `image_url`, `video_url`, or `edit_images` when available
193
305
 
194
306
  ### `get_task_result`
195
307
 
@@ -0,0 +1,3 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { FreebeatApiClient } from "../../services/freebeat-api.js";
3
+ export declare function registerMediaTools(server: McpServer, client: FreebeatApiClient): void;
@@ -0,0 +1,13 @@
1
+ import { registerEditImageTool } from "./tools/edit-image.js";
2
+ import { registerGenerateImageTool } from "./tools/generate-image.js";
3
+ import { registerGenerateVideoTool } from "./tools/generate-video.js";
4
+ import { registerGetModelHelpTool } from "./tools/get-model-help.js";
5
+ import { registerListModelsTool } from "./tools/list-models.js";
6
+ export function registerMediaTools(server, client) {
7
+ registerListModelsTool(server);
8
+ registerGetModelHelpTool(server);
9
+ registerGenerateImageTool(server, client);
10
+ registerEditImageTool(server, client);
11
+ registerGenerateVideoTool(server, client);
12
+ }
13
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/capabilities/media/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,MAAM,UAAU,kBAAkB,CAChC,MAAiB,EACjB,MAAyB;IAEzB,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACjC,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,yBAAyB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { FreebeatApiClient } from "../../../services/freebeat-api.js";
3
+ export declare function registerEditImageTool(server: McpServer, client: Pick<FreebeatApiClient, "createImageBatch">): void;
@@ -0,0 +1,78 @@
1
+ import { z } from "zod";
2
+ import { resolveCustomResolutionValue, resolveImageQuality, resolveImageResolution, resolveModelForCommand, validateImageCatalogConstraints, } from "../../../core/model-catalog.js";
3
+ import { normalizeGenerationPrompt } from "../../../core/prompt.js";
4
+ import { formatToolError, jsonContent } from "../../../core/response.js";
5
+ import { batchCreateOutputSchema, normalizeBatchCreate } from "./shared.js";
6
+ export function registerEditImageTool(server, client) {
7
+ server.registerTool("edit_image", {
8
+ description: "Create an Open RPC single-image edit batch. Use an image URL, usually from upload_image, then query progress with get_task_status using the returned batch_id.",
9
+ outputSchema: batchCreateOutputSchema,
10
+ inputSchema: {
11
+ model: z.string().min(1).describe("Image edit model id or API model key."),
12
+ image: z.string().min(1).describe("Single image URL to edit."),
13
+ prompt: z
14
+ .string()
15
+ .trim()
16
+ .min(1, "prompt must not be empty or whitespace only")
17
+ .max(2000, "prompt must be at most 2000 characters after trimming")
18
+ .describe("Image edit prompt."),
19
+ size: z
20
+ .string()
21
+ .optional()
22
+ .describe("Image size or aspect ratio for supported edit models."),
23
+ resolution: z
24
+ .string()
25
+ .optional()
26
+ .describe("Image resolution for supported models. GPT-Image 2 defaults to 1024x1024."),
27
+ quality: z
28
+ .string()
29
+ .optional()
30
+ .describe("Image quality for supported models. GPT-Image 2 supports low, medium, high."),
31
+ output_format: z
32
+ .string()
33
+ .optional()
34
+ .describe("Image output format for supported models, for example png or webp."),
35
+ custom_resolution: z
36
+ .boolean()
37
+ .optional()
38
+ .default(false)
39
+ .describe("Use custom image resolution when the selected model supports it."),
40
+ count: z.number().int().positive().optional().default(1).describe("Number of edits."),
41
+ },
42
+ }, async ({ model, image, prompt, size, resolution, quality, output_format, custom_resolution, count, }) => {
43
+ try {
44
+ const resolvedModel = resolveModelForCommand("image_edit", model);
45
+ const resolvedResolution = resolveImageResolution(resolvedModel, resolution, size);
46
+ validateImageCatalogConstraints(resolvedModel, {
47
+ size,
48
+ resolution: resolvedResolution,
49
+ quality,
50
+ outputFormat: output_format,
51
+ count,
52
+ customResolution: custom_resolution,
53
+ });
54
+ const response = await client.createImageBatch({
55
+ items: [
56
+ {
57
+ businessType: 11,
58
+ modelId: String(resolvedModel.modelId),
59
+ generationType: 8,
60
+ prompt: normalizeGenerationPrompt(prompt),
61
+ images: [image],
62
+ size,
63
+ resolution: resolvedResolution,
64
+ customResolution: resolveCustomResolutionValue(resolvedModel, Boolean(custom_resolution)),
65
+ quality: resolveImageQuality(resolvedModel, quality),
66
+ outputFormat: output_format,
67
+ count,
68
+ },
69
+ ],
70
+ });
71
+ return jsonContent(normalizeBatchCreate(response, "Image edit"));
72
+ }
73
+ catch (error) {
74
+ return formatToolError(error);
75
+ }
76
+ });
77
+ }
78
+ //# sourceMappingURL=edit-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-image.js","sourceRoot":"","sources":["../../../../src/capabilities/media/tools/edit-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,4BAA4B,EAC5B,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,UAAU,qBAAqB,CACnC,MAAiB,EACjB,MAAmD;IAEnD,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;QACE,WAAW,EACT,gKAAgK;QAClK,YAAY,EAAE,uBAAuB;QACrC,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;YAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YAC9D,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,IAAI,EAAE;iBACN,GAAG,CAAC,CAAC,EAAE,6CAA6C,CAAC;iBACrD,GAAG,CAAC,IAAI,EAAE,uDAAuD,CAAC;iBAClE,QAAQ,CAAC,oBAAoB,CAAC;YACjC,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,uDAAuD,CAAC;YACpE,UAAU,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,QAAQ,EAAE;iB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AAC;wBACzC,MAAM,EAAE,CAAC,KAAK,CAAC;wBACf,IAAI;wBACJ,UAAU,EAAE,kBAAkB;wBAC9B,gBAAgB,EAAE,4BAA4B,CAC5C,aAAa,EACb,OAAO,CAAC,iBAAiB,CAAC,CAC3B;wBACD,OAAO,EAAE,mBAAmB,CAAC,aAAa,EAAE,OAAO,CAAC;wBACpD,YAAY,EAAE,aAAa;wBAC3B,KAAK;qBACN;iBACF;aACF,CAAC,CAAC;YAEH,OAAO,WAAW,CAAC,oBAAoB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { FreebeatApiClient } from "../../../services/freebeat-api.js";
3
+ export declare function registerGenerateImageTool(server: McpServer, client: Pick<FreebeatApiClient, "createImageBatch">): void;
@@ -0,0 +1,73 @@
1
+ import { z } from "zod";
2
+ import { resolveCustomResolutionValue, resolveImageQuality, resolveImageResolution, resolveModelForCommand, validateImageCatalogConstraints, } from "../../../core/model-catalog.js";
3
+ import { normalizeGenerationPrompt } from "../../../core/prompt.js";
4
+ import { formatToolError, jsonContent } from "../../../core/response.js";
5
+ import { batchCreateOutputSchema, normalizeBatchCreate } from "./shared.js";
6
+ export function registerGenerateImageTool(server, client) {
7
+ server.registerTool("generate_image", {
8
+ description: "Create an Open RPC image generation batch. Recommended flow: list_models(type=image) -> generate_image -> get_task_status using the returned batch_id.",
9
+ outputSchema: batchCreateOutputSchema,
10
+ inputSchema: {
11
+ model: z.string().min(1).describe("Image model id or API model key."),
12
+ prompt: z
13
+ .string()
14
+ .trim()
15
+ .min(1, "prompt must not be empty or whitespace only")
16
+ .max(2000, "prompt must be at most 2000 characters after trimming")
17
+ .describe("Image generation prompt."),
18
+ size: z.string().optional().describe("Image size for supported models, for example 1024x1024."),
19
+ resolution: z
20
+ .string()
21
+ .optional()
22
+ .describe("Image resolution for supported models. GPT-Image 2 defaults to 1024x1024."),
23
+ quality: z
24
+ .string()
25
+ .optional()
26
+ .describe("Image quality for supported models. GPT-Image 2 supports low, medium, high."),
27
+ output_format: z
28
+ .string()
29
+ .optional()
30
+ .describe("Image output format for supported models, for example png or webp."),
31
+ custom_resolution: z
32
+ .boolean()
33
+ .optional()
34
+ .default(false)
35
+ .describe("Use custom image resolution when the selected model supports it."),
36
+ count: z.number().int().positive().optional().default(1).describe("Number of images."),
37
+ },
38
+ }, async ({ model, prompt, size, resolution, quality, output_format, custom_resolution, count }) => {
39
+ try {
40
+ const resolvedModel = resolveModelForCommand("image_generate", model);
41
+ const resolvedResolution = resolveImageResolution(resolvedModel, resolution, size);
42
+ validateImageCatalogConstraints(resolvedModel, {
43
+ size,
44
+ resolution: resolvedResolution,
45
+ quality,
46
+ outputFormat: output_format,
47
+ count,
48
+ customResolution: custom_resolution,
49
+ });
50
+ const response = await client.createImageBatch({
51
+ items: [
52
+ {
53
+ businessType: 9,
54
+ modelId: String(resolvedModel.modelId),
55
+ generationType: 6,
56
+ prompt: normalizeGenerationPrompt(prompt),
57
+ size,
58
+ resolution: resolvedResolution,
59
+ customResolution: resolveCustomResolutionValue(resolvedModel, Boolean(custom_resolution)),
60
+ quality: resolveImageQuality(resolvedModel, quality),
61
+ outputFormat: output_format,
62
+ count,
63
+ },
64
+ ],
65
+ });
66
+ return jsonContent(normalizeBatchCreate(response, "Image generation"));
67
+ }
68
+ catch (error) {
69
+ return formatToolError(error);
70
+ }
71
+ });
72
+ }
73
+ //# sourceMappingURL=generate-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-image.js","sourceRoot":"","sources":["../../../../src/capabilities/media/tools/generate-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,E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;QACzE,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { FreebeatApiClient } from "../../../services/freebeat-api.js";
3
+ export declare function registerGenerateVideoTool(server: McpServer, client: Pick<FreebeatApiClient, "createVideoBatch" | "createUploadUrl" | "uploadToPreSignedUrl">): void;
@@ -0,0 +1,124 @@
1
+ import { z } from "zod";
2
+ import { resolveGenerateAudioValue, resolveModelForCommand, resolveVideoAspectRatio, resolveVideoExtraParams, resolveVideoGenerationType, validateVideoGenerateOptions, } from "../../../core/model-catalog.js";
3
+ import { normalizeGenerationPrompt } from "../../../core/prompt.js";
4
+ import { formatToolError, jsonContent } from "../../../core/response.js";
5
+ import { UploadService } from "../../../services/upload-service.js";
6
+ import { detectImageMimeType, validateImageFile, validateImageMinimumDimensions, } from "../../../utils/file.js";
7
+ import { batchCreateOutputSchema, normalizeBatchCreate } from "./shared.js";
8
+ export function registerGenerateVideoTool(server, client) {
9
+ const uploadService = new UploadService(client);
10
+ server.registerTool("generate_video", {
11
+ description: "Create an Open RPC video batch. Supports text, image, transition, and reference generation when the selected model supports them. Recommended flow: list_models(type=video) -> get_model_help -> generate_video -> get_task_status using the returned batch_id.",
12
+ outputSchema: batchCreateOutputSchema,
13
+ inputSchema: {
14
+ model: z.string().min(1).describe("Video model id or API model key."),
15
+ prompt: z
16
+ .string()
17
+ .trim()
18
+ .min(1, "prompt must not be empty or whitespace only")
19
+ .max(2000, "prompt must be at most 2000 characters after trimming")
20
+ .describe("Video generation prompt."),
21
+ generation_type: z
22
+ .string()
23
+ .optional()
24
+ .default("text")
25
+ .describe("Generation type: text, image, transition, or reference."),
26
+ images: z
27
+ .array(z.string())
28
+ .optional()
29
+ .describe("Image URLs or local image paths for image, transition, or reference generation."),
30
+ duration: z.number().int().positive().optional().describe("Video duration in seconds."),
31
+ resolution: z.string().optional().describe("Video resolution, for example 720p."),
32
+ aspect_ratio: z.string().optional().describe("Video aspect ratio, for example 16:9."),
33
+ style: z.string().optional().describe("Video style when supported by the selected model."),
34
+ generate_audio: z
35
+ .boolean()
36
+ .optional()
37
+ .default(false)
38
+ .describe("Generate video audio when the selected model supports it."),
39
+ multi_clip: z
40
+ .boolean()
41
+ .optional()
42
+ .default(false)
43
+ .describe("Generate multiple clips when the selected model supports it."),
44
+ watermark: z
45
+ .boolean()
46
+ .optional()
47
+ .default(false)
48
+ .describe("Include a watermark when needed by the target account or environment."),
49
+ },
50
+ }, async ({ model, prompt, generation_type, images, duration, resolution, aspect_ratio, style, generate_audio, multi_clip, watermark, }) => {
51
+ try {
52
+ const resolvedModel = resolveModelForCommand("video_generate", model);
53
+ const generationType = resolveVideoGenerationType(resolvedModel, generation_type ?? "text");
54
+ const imageInputs = images ?? [];
55
+ validateVideoGenerateOptions(resolvedModel, {
56
+ duration,
57
+ resolution,
58
+ aspectRatio: aspect_ratio,
59
+ style,
60
+ generateAudio: generate_audio,
61
+ multiClip: multi_clip,
62
+ }, generationType, imageInputs);
63
+ const resolvedImages = await resolveVideoImageInputs(uploadService, imageInputs, generationType);
64
+ const aspectRatio = resolveVideoAspectRatio(resolvedModel, aspect_ratio, generationType);
65
+ const audio = resolveGenerateAudioValue(resolvedModel, Boolean(generate_audio));
66
+ const videoBatchItem = {
67
+ modelId: String(resolvedModel.modelId),
68
+ generationType,
69
+ prompt: normalizeGenerationPrompt(prompt),
70
+ images: resolvedImages,
71
+ duration,
72
+ resolution,
73
+ aspectRatio,
74
+ style,
75
+ audio,
76
+ generateAudio: audio,
77
+ watermark: watermark ? 1 : 0,
78
+ };
79
+ const extraParams = resolveVideoExtraParams(resolvedModel, Boolean(multi_clip));
80
+ if (extraParams) {
81
+ videoBatchItem.extraParams = extraParams;
82
+ }
83
+ const response = await client.createVideoBatch({
84
+ items: [videoBatchItem],
85
+ });
86
+ return jsonContent(normalizeBatchCreate(response, "Video generation"));
87
+ }
88
+ catch (error) {
89
+ return formatToolError(error);
90
+ }
91
+ });
92
+ }
93
+ async function resolveVideoImageInputs(uploadService, inputs, generationType) {
94
+ if (generationType === 1) {
95
+ return undefined;
96
+ }
97
+ const resolved = [];
98
+ for (const [index, input] of inputs.entries()) {
99
+ if (isProbablyUrl(input)) {
100
+ resolved.push(input);
101
+ continue;
102
+ }
103
+ validateImageFile(input);
104
+ validateImageMinimumDimensions(input, 300, 300);
105
+ const uploadedUrl = await uploadService.uploadLocalFile({
106
+ filePath: input,
107
+ keyPrefix: "agent/character",
108
+ contentType: detectImageMimeType(input),
109
+ keySuffix: String(index),
110
+ });
111
+ resolved.push(uploadedUrl);
112
+ }
113
+ return resolved;
114
+ }
115
+ function isProbablyUrl(value) {
116
+ try {
117
+ const url = new URL(value);
118
+ return url.protocol === "http:" || url.protocol === "https:";
119
+ }
120
+ catch {
121
+ return false;
122
+ }
123
+ }
124
+ //# sourceMappingURL=generate-video.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-video.js","sourceRoot":"","sources":["../../../../src/capabilities/media/tools/generate-video.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,aAAa,C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AG,CAAC,CAAC;QAChD,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,eAAe,CAAC;YACtD,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,iBAAiB;YAC5B,WAAW,EAAE,mBAAmB,CAAC,KAAK,CAAC;YACvC,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC;SACzB,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerGetModelHelpTool(server: McpServer): void;
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ import { formatToolError, jsonContent } from "../../../core/response.js";
3
+ import { getModelHelp } from "../../../core/model-catalog.js";
4
+ export function registerGetModelHelpTool(server) {
5
+ server.registerTool("get_model_help", {
6
+ description: "Show detailed usage guidance for one Open RPC image or video model. Use the returned help to set required duration, resolution, aspect_ratio, quality, and audio options.",
7
+ outputSchema: {
8
+ success: z.literal(true).describe("Whether model help was retrieved successfully."),
9
+ help: z.string().describe("Model-specific usage and constraints."),
10
+ },
11
+ inputSchema: {
12
+ model: z.string().min(1).describe("Model id or API model key to inspect."),
13
+ },
14
+ }, async ({ model }) => {
15
+ try {
16
+ return jsonContent({
17
+ success: true,
18
+ help: getModelHelp(model),
19
+ });
20
+ }
21
+ catch (error) {
22
+ return formatToolError(error);
23
+ }
24
+ });
25
+ }
26
+ //# sourceMappingURL=get-model-help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-model-help.js","sourceRoot":"","sources":["../../../../src/capabilities/media/tools/get-model-help.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,WAAW,EACT,2KAA2K;QAC7K,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,gDAAgD,CAAC;YACnF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;SACnE;QACD,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;SAC3E;KACF,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAClB,IAAI,CAAC;YACH,OAAO,WAAW,CAAC;gBACjB,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC;aAC1B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerListModelsTool(server: McpServer): void;
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ import { formatToolError, jsonContent } from "../../../core/response.js";
3
+ import { listModels } from "../../../core/model-catalog.js";
4
+ import { modelListMessage, normalizeModel } from "./shared.js";
5
+ export function registerListModelsTool(server) {
6
+ server.registerTool("list_models", {
7
+ description: "List supported Open RPC image or video models. Use this before generate_image, edit_image, or generate_video to choose the model value and inspect constraints.",
8
+ outputSchema: {
9
+ success: z.literal(true).describe("Whether model discovery completed successfully."),
10
+ models: z
11
+ .array(z.record(z.unknown()))
12
+ .describe("Supported models with model IDs, model keys, commands, and constraints."),
13
+ message: z.string().describe("Human-readable summary."),
14
+ },
15
+ inputSchema: {
16
+ type: z.enum(["image", "video"]).describe("Model type to list."),
17
+ },
18
+ }, async ({ type }) => {
19
+ try {
20
+ const models = listModels(type);
21
+ return jsonContent({
22
+ success: true,
23
+ models: models.map(normalizeModel),
24
+ message: modelListMessage(type, models.length),
25
+ });
26
+ }
27
+ catch (error) {
28
+ return formatToolError(error);
29
+ }
30
+ });
31
+ }
32
+ //# sourceMappingURL=list-models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-models.js","sourceRoot":"","sources":["../../../../src/capabilities/media/tools/list-models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;QACE,WAAW,EACT,iKAAiK;QACnK,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,iDAAiD,CAAC;YACpF,MAAM,EAAE,CAAC;iBACN,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;iBAC5B,QAAQ,CAAC,yEAAyE,CAAC;YACtF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;SACxD;QACD,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,qBAAqB,CAAC;SACjE;KACF,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YAEhC,OAAO,WAAW,CAAC;gBACjB,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC;gBAClC,OAAO,EAAE,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;aAC/C,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ import { OpenRpcBatchCreateResponse } from "../../../services/freebeat-api.js";
3
+ import { ModelKind, StaticModelCatalogItem as CatalogModel } from "../../../core/model-catalog.js";
4
+ export declare const batchCreateOutputSchema: {
5
+ success: z.ZodLiteral<true>;
6
+ batch_id: z.ZodString;
7
+ batch_status: z.ZodString;
8
+ total_count: z.ZodNumber;
9
+ accepted_count: z.ZodNumber;
10
+ failed_count: z.ZodNumber;
11
+ accepted_credits: z.ZodNumber;
12
+ estimated_failed_credits: z.ZodNumber;
13
+ items: z.ZodArray<z.ZodObject<{
14
+ business_type: z.ZodNumber;
15
+ accepted: z.ZodBoolean;
16
+ serial_no: z.ZodNullable<z.ZodString>;
17
+ need_credits: z.ZodNumber;
18
+ status: z.ZodString;
19
+ code: z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
20
+ message: z.ZodNullable<z.ZodString>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ code: string | number | null;
23
+ message: string | null;
24
+ status: string;
25
+ accepted: boolean;
26
+ business_type: number;
27
+ serial_no: string | null;
28
+ need_credits: number;
29
+ }, {
30
+ code: string | number | null;
31
+ message: string | null;
32
+ status: string;
33
+ accepted: boolean;
34
+ business_type: number;
35
+ serial_no: string | null;
36
+ need_credits: number;
37
+ }>, "many">;
38
+ message: z.ZodString;
39
+ };
40
+ export declare function normalizeBatchCreate(response: OpenRpcBatchCreateResponse, noun: string): Record<string, unknown>;
41
+ export declare function normalizeModel(model: CatalogModel): Record<string, unknown>;
42
+ export declare function modelListMessage(kind: ModelKind, count: number): string;