freebeat-mcp 0.2.1 → 0.4.0
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/CHANGELOG.md +28 -0
- package/README.md +65 -12
- package/dist/capabilities/agents/register.js +2 -2
- package/dist/capabilities/agents/register.js.map +1 -1
- package/dist/capabilities/agents/tools/{create-agent-video.d.ts → generate-agent-videos.d.ts} +1 -1
- package/dist/capabilities/agents/tools/generate-agent-videos.js +103 -0
- package/dist/capabilities/agents/tools/generate-agent-videos.js.map +1 -0
- package/dist/capabilities/assets/tools/upload-audio.js +3 -3
- package/dist/capabilities/assets/tools/upload-audio.js.map +1 -1
- package/dist/capabilities/assets/tools/upload-image.js +2 -2
- package/dist/capabilities/assets/tools/upload-image.js.map +1 -1
- package/dist/capabilities/assets/tools/upload-video.js +2 -2
- package/dist/capabilities/assets/tools/upload-video.js.map +1 -1
- package/dist/capabilities/credits/register.d.ts +3 -0
- package/dist/capabilities/credits/register.js +41 -0
- package/dist/capabilities/credits/register.js.map +1 -0
- package/dist/capabilities/effects/tools/generate-effect.js +7 -2
- package/dist/capabilities/effects/tools/generate-effect.js.map +1 -1
- package/dist/capabilities/effects/tools/list-effects.js +1 -1
- package/dist/capabilities/effects/tools/list-effects.js.map +1 -1
- package/dist/capabilities/media/tools/edit-image.js +8 -19
- package/dist/capabilities/media/tools/edit-image.js.map +1 -1
- package/dist/capabilities/media/tools/generate-image.js +8 -18
- package/dist/capabilities/media/tools/generate-image.js.map +1 -1
- package/dist/capabilities/media/tools/generate-text.js +6 -1
- package/dist/capabilities/media/tools/generate-text.js.map +1 -1
- package/dist/capabilities/media/tools/generate-video.js +8 -21
- package/dist/capabilities/media/tools/generate-video.js.map +1 -1
- package/dist/capabilities/media/tools/get-model-help.js +1 -1
- package/dist/capabilities/media/tools/get-model-help.js.map +1 -1
- package/dist/capabilities/media/tools/list-models.js +1 -1
- package/dist/capabilities/media/tools/list-models.js.map +1 -1
- package/dist/capabilities/media/tools/shared.d.ts +18 -2
- package/dist/capabilities/media/tools/shared.js +3 -0
- package/dist/capabilities/media/tools/shared.js.map +1 -1
- package/dist/capabilities/music/tools/generate-music.js +7 -2
- package/dist/capabilities/music/tools/generate-music.js.map +1 -1
- package/dist/capabilities/music/tools/list-music-models.js +7 -4
- package/dist/capabilities/music/tools/list-music-models.js.map +1 -1
- package/dist/capabilities/performance/tools/generate-lip-sync-video.js +7 -2
- package/dist/capabilities/performance/tools/generate-lip-sync-video.js.map +1 -1
- package/dist/capabilities/performance/tools/generate-singing-video.js +7 -2
- package/dist/capabilities/performance/tools/generate-singing-video.js.map +1 -1
- package/dist/capabilities/tasks/tools/get-task-result.js +12 -5
- package/dist/capabilities/tasks/tools/get-task-result.js.map +1 -1
- package/dist/capabilities/tasks/tools/get-task-status.js +6 -1
- package/dist/capabilities/tasks/tools/get-task-status.js.map +1 -1
- package/dist/core/credit-approval.d.ts +26 -0
- package/dist/core/credit-approval.js +28 -0
- package/dist/core/credit-approval.js.map +1 -0
- package/dist/core/paid-tools.d.ts +11 -0
- package/dist/core/paid-tools.js +6 -0
- package/dist/core/paid-tools.js.map +1 -0
- package/dist/core/response.js +8 -3
- package/dist/core/response.js.map +1 -1
- package/dist/core/tool-annotations.d.ts +1 -1
- package/dist/core/tool-annotations.js +2 -1
- package/dist/core/tool-annotations.js.map +1 -1
- package/dist/server.js +5 -3
- package/dist/server.js.map +1 -1
- package/dist/services/freebeat-api.d.ts +214 -80
- package/dist/services/freebeat-api.js +257 -127
- package/dist/services/freebeat-api.js.map +1 -1
- package/dist/services/generation-requests.d.ts +26 -0
- package/dist/services/generation-requests.js +86 -0
- package/dist/services/generation-requests.js.map +1 -0
- package/dist/services/media-validation.d.ts +1 -0
- package/dist/services/media-validation.js +221 -0
- package/dist/services/media-validation.js.map +1 -0
- package/dist/services/pricing.d.ts +14 -0
- package/dist/services/pricing.js +277 -0
- package/dist/services/pricing.js.map +1 -0
- package/dist/services/remote-media.d.ts +0 -1
- package/dist/services/remote-media.js +22 -52
- package/dist/services/remote-media.js.map +1 -1
- package/package.json +3 -3
- package/dist/capabilities/agents/tools/create-agent-video.js +0 -83
- package/dist/capabilities/agents/tools/create-agent-video.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,34 @@ The format is based on Keep a Changelog, and this project follows Semantic Versi
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.4.0] - 2026-10-26
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Optional `max_credits` on every paid tool, checked against the current quote before submission; refused calls return the quote and reason, and submitted calls report their quote separately from actual charges.
|
|
13
|
+
- Read-only `get_credit_balance` and `quote_generation` tools, covering every paid tool with a current list-price quote or an explicit unavailable result.
|
|
14
|
+
- Backend price-rule evaluation for fixed, duration, combination, formula and branch rules without executing backend scripts as code.
|
|
15
|
+
- Actual credit charges on task results when reported by Freebeat; missing charges remain explicitly unknown.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Remote uploads require an accepted declared Content-Type and a matching leading-byte signature. Only Freebeat media hosts `static.freebeat.ai` and `static.freebeatfit.com` may serve `application/octet-stream`; third-party links must serve a proper media type or use the generated-song `music_id` handoff.
|
|
19
|
+
- Removed deep audio/video container parsing, its concurrency limiter, the media worker, and unused `mediabunny`, `jpeg-js` and `pngjs` dependencies. PNG/JPEG structural checks and image size/dimension limits remain, without pixel decoding; internal validation failures stay distinct from invalid files.
|
|
20
|
+
- Server version metadata uses a static JSON import so webpack standalone output no longer reads the original build directory. Node support is `^18.20.0 || >=20.10.0` for JSON import attributes.
|
|
21
|
+
- Quotes and submissions share normalized media/music/lip-sync requests; reference-image counts come from the submitted inputs. Missing price-rule variables now return unavailable instead of selecting a cheaper branch.
|
|
22
|
+
- Lip-sync status parsing no longer requires unrelated display metadata; unreadable task responses report unknown state and a viewing link. Lip-sync generation uses the backend's configured default model.
|
|
23
|
+
- Generated music results can feed the three song-driven video tools directly, with automatic audio preparation.
|
|
24
|
+
- All three agent tools relay the agent's own pause reason and next step with structured credit notices.
|
|
25
|
+
- Music capabilities and submission prices come from current catalog/rule data instead of model-ID lists and stale prices. Missing length control is explained before generation.
|
|
26
|
+
- Backend errors use user-facing recovery guidance instead of exposing account identifiers or backend fields.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Write tools set `openWorldHint: true`: they send prompts and media to third-party model providers and accept arbitrary URLs, which OpenAI's tool scan flagged.
|
|
30
|
+
|
|
31
|
+
## [0.3.0] - 2026-10-23
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- Breaking: replaced `create_agent_video` with `generate_music_video`, `generate_dance_video`, and `generate_lyric_video`, with no alias or `product` input. Each tool exposes its product's supported resolutions and shares the existing agent implementation.
|
|
35
|
+
- Updated tool descriptions, submission cases, and usage references for the 20-tool surface.
|
|
36
|
+
|
|
9
37
|
## [0.2.1] - 2026-10-23
|
|
10
38
|
|
|
11
39
|
### Changed
|
package/README.md
CHANGED
|
@@ -83,6 +83,24 @@ This package depends on Freebeat online services. Available source platforms, ef
|
|
|
83
83
|
|
|
84
84
|
## Tools
|
|
85
85
|
|
|
86
|
+
22 tools are available with full scopes.
|
|
87
|
+
|
|
88
|
+
### `get_credit_balance` and `quote_generation`
|
|
89
|
+
|
|
90
|
+
Read the current credit balance with `get_credit_balance`. Before any paid call, use
|
|
91
|
+
`quote_generation` with `tool` and `parameters` containing the planned generation
|
|
92
|
+
inputs. It evaluates Freebeat's current pricing rules and returns `status: quoted`
|
|
93
|
+
with `credits`, or `status: unavailable` with a reason. Quotes are list prices before
|
|
94
|
+
account discounts or allowances and never charge credits. Missing or unsupported
|
|
95
|
+
rules are not treated as free. Text, effects, singing, and multi-stage agents do not
|
|
96
|
+
currently expose a complete upfront quote through their service contracts.
|
|
97
|
+
|
|
98
|
+
Set `max_credits` on every paid tool to the numeric quote or ceiling the user approved. If the current price is higher or unavailable, the tool does not submit and returns `quote` and a reason. Never remove or raise an approved ceiling to bypass this refusal. Without a ceiling, existing submission behavior remains and the result includes the current `quote`; a quote is not an actual charge.
|
|
99
|
+
|
|
100
|
+
Finished tasks expose `used_credits` when Freebeat reports an actual charge. Otherwise
|
|
101
|
+
they explicitly state that the charge was not reported; token usage, estimates,
|
|
102
|
+
and a next-step credit requirement are not actual charges.
|
|
103
|
+
|
|
86
104
|
### `upload_audio`
|
|
87
105
|
|
|
88
106
|
Upload a local audio file or import from a music platform URL.
|
|
@@ -103,7 +121,7 @@ Provide exactly one of:
|
|
|
103
121
|
- `file_path`, for local stdio installations only
|
|
104
122
|
- `url`, for a supported music platform
|
|
105
123
|
|
|
106
|
-
Returns a `music_id` that can be used by
|
|
124
|
+
Returns a `music_id` that can be used by `generate_music_video`, `generate_dance_video`, `generate_lyric_video`, or `generate_effect`.
|
|
107
125
|
|
|
108
126
|
### `upload_image`
|
|
109
127
|
|
|
@@ -112,7 +130,7 @@ Upload one or two images and receive `image_urls`.
|
|
|
112
130
|
Provide exactly one of `files` (ChatGPT attachments), `file_paths` (local stdio
|
|
113
131
|
only), or `urls` (guarded public HTTPS downloads).
|
|
114
132
|
|
|
115
|
-
For agent videos, pass the returned `image_urls` into `
|
|
133
|
+
For agent videos, pass the returned `image_urls` into the `image_urls` parameter of `generate_music_video`, `generate_dance_video`, or `generate_lyric_video`.
|
|
116
134
|
|
|
117
135
|
For effect generation, the default recommendation is still `list_effects.image_url`, but you can also upload one image and pass `image_urls[0]` into `generate_effect.reference_image_urls`.
|
|
118
136
|
|
|
@@ -124,8 +142,34 @@ Upload one MP4, MOV, or WebM clip and receive a `video_url` for
|
|
|
124
142
|
|
|
125
143
|
Hosted HTTP mode never reads caller-provided local file paths. Attachment and
|
|
126
144
|
URL downloads require HTTPS, reject private or reserved network addresses and
|
|
127
|
-
redirects,
|
|
128
|
-
files that are removed after upload.
|
|
145
|
+
redirects, identify allowed media types from the file bytes, and stream to size-limited temporary
|
|
146
|
+
files that are removed after upload. Remote uploads require a declared Content-Type accepted by the upload tool and a matching file signature. Only the exact Freebeat media hosts `static.freebeat.ai` and `static.freebeatfit.com` may serve `application/octet-stream`; their bytes must still match an accepted media type. Audio/video checks read only the first 16 bytes, without parsing tracks or packets; MP4/MOV must also have data beyond the leading ftyp box. PNG/JPEG structure and dimensions are checked without decoding pixels: PNG chunk CRCs and required chunks, or JPEG frame/scan/end markers, with a 10 MiB encoded-file and 16-million-pixel limit. Image scans yield every 64 KiB of work and check a cooperative 5-second deadline. Internal failures return a separate temporary validation error. These checks do not prove full playback or pixel integrity; downstream services decode the media. For Freebeat-generated songs, pass the `music_id` from `get_task_result` directly to video tools.
|
|
147
|
+
|
|
148
|
+
### `list_music_models`
|
|
149
|
+
|
|
150
|
+
List music-generation models, published input capabilities and current pricing before
|
|
151
|
+
calling `generate_music`. Unknown capabilities are `null`, not guessed from model IDs.
|
|
152
|
+
When length control is not offered, a prompt cannot guarantee the song's duration.
|
|
153
|
+
Use `quote_generation` with the prompt and other planned inputs for a specific quote.
|
|
154
|
+
|
|
155
|
+
### `generate_music`
|
|
156
|
+
|
|
157
|
+
Generate original audio from a `model_id` and `prompt`, with optional lyrics, instrumental mode, and duration when supported by the model. Poll `get_task_status`, then call `get_task_result` after completion. This does not turn an existing song into a video.
|
|
158
|
+
|
|
159
|
+
Pass the completed `result.music_id` (a reference such as `music:123`) straight into
|
|
160
|
+
`generate_music_video`, `generate_dance_video`, or `generate_lyric_video`. The video
|
|
161
|
+
call resolves and prepares your generated song automatically. If audio analysis is
|
|
162
|
+
still running, retry after it finishes; no download or manual re-upload is required.
|
|
163
|
+
Music submissions require a current price rule; stale catalog credit amounts are
|
|
164
|
+
never sent as the price.
|
|
165
|
+
|
|
166
|
+
### `generate_singing_video`
|
|
167
|
+
|
|
168
|
+
Make a photo, pet, or duet sing a track as a short performance. Provide `mode`, `image_urls`, `duration_seconds`, and exactly one of `music_id` or `audio_url`. Poll `get_task_status`, then call `get_task_result` after completion.
|
|
169
|
+
|
|
170
|
+
### `generate_lip_sync_video`
|
|
171
|
+
|
|
172
|
+
Lip-sync an existing clip to audio. Provide `video_url`, `video_duration_ms`, and exactly one of `music_id` or `audio_url`; `audio_url` also requires `audio_duration_ms`. Poll `get_task_status`, then call `get_task_result` after completion.
|
|
129
173
|
|
|
130
174
|
### `list_effects`
|
|
131
175
|
|
|
@@ -174,22 +218,31 @@ Returns a task envelope with:
|
|
|
174
218
|
- `task_type` currently `effect_generation`
|
|
175
219
|
- `status`
|
|
176
220
|
|
|
177
|
-
### `
|
|
221
|
+
### `generate_music_video`
|
|
222
|
+
|
|
223
|
+
Create a multi-scene music video timed to a song, optionally featuring people or characters from photos. Supports `720p` (default) and `1080p`.
|
|
224
|
+
|
|
225
|
+
### `generate_dance_video`
|
|
226
|
+
|
|
227
|
+
Create dancers performing to a song; people in optional photos become the dancers. Supports `720p` and vertical formats including `9:16` and `3:4`.
|
|
228
|
+
|
|
229
|
+
### `generate_lyric_video`
|
|
230
|
+
|
|
231
|
+
Create animated lyrics timed to a song's vocals. Supports `768P` (default) and `2K`, with optional reference photos.
|
|
178
232
|
|
|
179
|
-
|
|
233
|
+
All three tools use the existing agents in Auto mode, usually take 15–60 minutes, and use the user's existing Freebeat credits. Each tool selects its product internally; there is no `product` parameter.
|
|
180
234
|
|
|
181
235
|
Parameters:
|
|
182
236
|
|
|
183
|
-
- `
|
|
184
|
-
- `music_id` required, from `upload_audio`
|
|
237
|
+
- `music_id` required, from `upload_audio` or a completed `generate_music` result
|
|
185
238
|
- `prompt` optional creative direction
|
|
186
|
-
- `start_ms` / `end_ms` optional song window, default the first 15 seconds;
|
|
239
|
+
- `start_ms` / `end_ms` optional song window, default the first 15 seconds, or up to the song's end if shorter; the selected window must fit the song and account limits
|
|
187
240
|
- `aspect_ratio` optional, default `16:9`
|
|
188
|
-
- `resolution` optional:
|
|
241
|
+
- `resolution` optional: limited to the selected tool's supported resolutions
|
|
189
242
|
- `image_urls` optional photos from `upload_image`
|
|
190
243
|
- `remove_watermark` optional, default `false`
|
|
191
244
|
|
|
192
|
-
Returns `task_id`, `task_type`, `status`, and `session_url`, the freebeat.ai page for the session. `get_task_status` reports `running`, `completed`, or `action_required`; on `action_required` (for example the account ran out of credits, or the agent needs a decision)
|
|
245
|
+
Returns `task_id`, `task_type`, `status`, and `session_url`, the freebeat.ai page for the session. `get_task_status` reports `running`, `completed`, or `action_required`; on `action_required` (for example the account ran out of credits, or the agent needs a decision) relay the message and `session_url` to the user.
|
|
193
246
|
|
|
194
247
|
### `list_models`
|
|
195
248
|
|
|
@@ -230,7 +283,7 @@ Ask any text model from `list_models(type=text)` and get its reply. Parameters:
|
|
|
230
283
|
|
|
231
284
|
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.
|
|
232
285
|
|
|
233
|
-
For agent videos, effects, music, singing, and lip-sync tasks, continue polling while the status is still in progress. Agent videos may also report `action_required` with a `session_url` for
|
|
286
|
+
For agent videos, effects, music, singing, and lip-sync tasks, continue polling while the status is still in progress. Agent videos may also report `action_required` with their own last message, any structured credit notice, and a `session_url` for reviewing and continuing. Only call `get_task_result` after the status is `completed`. If a task response cannot be read, `get_task_status` reports `unknown` and a viewing link; this is not a generation failure and must not trigger another paid submission.
|
|
234
287
|
|
|
235
288
|
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.
|
|
236
289
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ALL_TOOL_ACCESS } from "../../core/scopes.js";
|
|
2
|
-
import {
|
|
2
|
+
import { registerGenerateAgentVideoTools } from "./tools/generate-agent-videos.js";
|
|
3
3
|
export function registerAgentTools(server, client, access = ALL_TOOL_ACCESS) {
|
|
4
4
|
if (access.generate)
|
|
5
|
-
|
|
5
|
+
registerGenerateAgentVideoTools(server, client);
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/capabilities/agents/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/capabilities/agents/register.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAc,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,MAAM,UAAU,kBAAkB,CAChC,MAAiB,EACjB,MAAyB,EACzB,SAAqB,eAAe;IAEpC,IAAI,MAAM,CAAC,QAAQ;QAAE,+BAA+B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/capabilities/agents/tools/{create-agent-video.d.ts → generate-agent-videos.d.ts}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { FreebeatApiClient } from "../../../services/freebeat-api.js";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function registerGenerateAgentVideoTools(server: McpServer, client: Pick<FreebeatApiClient, "createAgentVideo">): void;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { maxCreditsSchema, creditQuoteSchema } from "../../../core/credit-approval.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { AGENT_PRODUCTS } from "../../../core/agent-products.js";
|
|
4
|
+
import { formatToolError, jsonContent } from "../../../core/response.js";
|
|
5
|
+
import { CREATE_TOOL_ANNOTATIONS } from "../../../core/tool-annotations.js";
|
|
6
|
+
const AGENT_VIDEO_TOOLS = {
|
|
7
|
+
music_video: {
|
|
8
|
+
name: "generate_music_video",
|
|
9
|
+
title: "Generate music video",
|
|
10
|
+
description: "Use this for music video generation: the user wants a music video (MV) for a song. Freebeat's music video agent plans scenes and generates and edits a multi-scene video timed to the song; people or characters from optional photos can appear. Requires music_id from upload_audio or a completed generate_music result; optional photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required relay the message and session_url. Do not use for dance videos, lyric videos, short singing-photo clips, lip-sync of an existing clip, standalone video clips without a song, or generating audio.",
|
|
11
|
+
},
|
|
12
|
+
dance: {
|
|
13
|
+
name: "generate_dance_video",
|
|
14
|
+
title: "Generate dance video",
|
|
15
|
+
description: "Use this for dance video generation: the user wants dancers performing to a song. Freebeat's dance video agent plans and generates a dance video timed to the song; people in optional photos become the dancers. Supports vertical 9:16 and 3:4 formats. Requires music_id from upload_audio or a completed generate_music result; optional photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required relay the message and session_url. Do not use for story-based music videos, lyric videos, short singing-photo clips, lip-sync of an existing clip, standalone video clips without a song, or generating audio.",
|
|
16
|
+
},
|
|
17
|
+
lyric_video: {
|
|
18
|
+
name: "generate_lyric_video",
|
|
19
|
+
title: "Generate lyric video",
|
|
20
|
+
description: "Use this for lyric video generation: the user wants animated lyrics timed to the vocals of a song. Freebeat's lyric video agent plans, generates, and edits the lyric video. Requires music_id from upload_audio or a completed generate_music result; optional reference photos via upload_image. Starts a generation job that uses the user's existing Freebeat credits and usually takes 15–60 minutes; by default it uses the first 15 seconds of the song, or up to the song's end if shorter. Returns task_id and session_url; poll get_task_status every few minutes, call get_task_result after completed; on action_required relay the message and session_url. Do not use for story-based music videos, dance videos, short singing-photo clips, lip-sync of an existing clip, standalone video clips without a song, or generating audio.",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export function registerGenerateAgentVideoTools(server, client) {
|
|
24
|
+
for (const product of Object.keys(AGENT_VIDEO_TOOLS)) {
|
|
25
|
+
const tool = AGENT_VIDEO_TOOLS[product];
|
|
26
|
+
server.registerTool(tool.name, {
|
|
27
|
+
description: `Before spending credits, call quote_generation with this tool and its planned parameters, then tell the user the price or that it is unavailable. Set max_credits to the user-approved quote or ceiling. A higher or unknown price stops submission; never remove or raise the ceiling without approval. ${tool.description}`,
|
|
28
|
+
annotations: { title: tool.title, ...CREATE_TOOL_ANNOTATIONS },
|
|
29
|
+
inputSchema: {
|
|
30
|
+
max_credits: maxCreditsSchema,
|
|
31
|
+
music_id: z.union([z.number().int().positive(), z.string().regex(/^music:.+/)])
|
|
32
|
+
.describe("An analyzed music_id from upload_audio, or result.music_id from a completed generate_music task. Generated songs are prepared automatically; no manual upload is needed."),
|
|
33
|
+
prompt: z
|
|
34
|
+
.string()
|
|
35
|
+
.trim()
|
|
36
|
+
.max(2000)
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("The user's creative direction in their own words. Leave empty to let the agent decide."),
|
|
39
|
+
start_ms: z
|
|
40
|
+
.number()
|
|
41
|
+
.int()
|
|
42
|
+
.min(0)
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Start of the song window in milliseconds. Defaults to 0."),
|
|
45
|
+
end_ms: z
|
|
46
|
+
.number()
|
|
47
|
+
.int()
|
|
48
|
+
.positive()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("End of the song window in milliseconds. Defaults to start_ms + 15000, capped at the song end. The selected window must fit the song and the account limits."),
|
|
51
|
+
aspect_ratio: z
|
|
52
|
+
.enum(["16:9", "9:16", "1:1", "4:3", "3:4"])
|
|
53
|
+
.default("16:9")
|
|
54
|
+
.describe("Output aspect ratio."),
|
|
55
|
+
resolution: z
|
|
56
|
+
.enum(AGENT_PRODUCTS[product].resolutions)
|
|
57
|
+
.optional()
|
|
58
|
+
.describe(`Output resolution. Defaults to ${AGENT_PRODUCTS[product].resolutions[0]}.`),
|
|
59
|
+
image_urls: z
|
|
60
|
+
.array(z.string().url())
|
|
61
|
+
.max(5)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe(product === "dance"
|
|
64
|
+
? "Optional photo URLs from upload_image of the dancers to feature."
|
|
65
|
+
: "Optional reference photo URLs from upload_image."),
|
|
66
|
+
remove_watermark: z
|
|
67
|
+
.boolean()
|
|
68
|
+
.default(false)
|
|
69
|
+
.describe("Remove the Freebeat watermark if the account allows it."),
|
|
70
|
+
},
|
|
71
|
+
outputSchema: {
|
|
72
|
+
quote: creditQuoteSchema.optional(),
|
|
73
|
+
success: z.literal(true),
|
|
74
|
+
task_id: z
|
|
75
|
+
.string()
|
|
76
|
+
.describe("The scoped task ID for get_task_status and get_task_result."),
|
|
77
|
+
task_type: z.string().describe("The task category."),
|
|
78
|
+
status: z.string().describe("The initial task status, typically pending."),
|
|
79
|
+
session_url: z
|
|
80
|
+
.string()
|
|
81
|
+
.describe("The freebeat.ai page where the user can watch, review, or continue this session."),
|
|
82
|
+
message: z.string().describe("What to do next."),
|
|
83
|
+
},
|
|
84
|
+
}, async (params) => {
|
|
85
|
+
try {
|
|
86
|
+
const result = await client.createAgentVideo({ ...params, product });
|
|
87
|
+
return jsonContent({
|
|
88
|
+
success: true,
|
|
89
|
+
quote: result.quote,
|
|
90
|
+
task_id: result.task_id,
|
|
91
|
+
task_type: result.task_type,
|
|
92
|
+
status: result.status,
|
|
93
|
+
session_url: result.session_url,
|
|
94
|
+
message: "The Freebeat agent started. Poll get_task_status every few minutes; full videos usually take 15-60 minutes. Share session_url if the user wants to watch it work.",
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
return formatToolError(error);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=generate-agent-videos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-agent-videos.js","sourceRoot":"","sources":["../../../../src/capabilities/agents/tools/generate-ag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const uploadService = new UploadService(client);
|
|
23
23
|
server.registerTool("upload_audio", {
|
|
24
|
-
description: "
|
|
24
|
+
description: "Use this when the user needs to upload an attached audio file, upload a local audio file in stdio mode, or import from a supported music URL. Supported platforms: SoundCloud, YouTube, Suno, Udio, TikTok, Stable Audio, and Riffusion. Provide exactly one of file, file_path, or url. Returns music_id for generate_music_video, generate_dance_video, generate_lyric_video and other audio workflows. Does not generate audio or video.",
|
|
25
25
|
annotations: { title: "Upload audio", ...CREATE_TOOL_ANNOTATIONS },
|
|
26
26
|
_meta: { "openai/fileParams": ["file"] },
|
|
27
27
|
outputSchema: {
|
|
@@ -30,7 +30,7 @@ export function registerUploadAudioTool(server, client, allowLocalFiles = true)
|
|
|
30
30
|
.describe("Whether the audio upload or import completed successfully."),
|
|
31
31
|
music_id: z
|
|
32
32
|
.number()
|
|
33
|
-
.describe("The audio asset ID to pass into
|
|
33
|
+
.describe("The audio asset ID to pass into generate_music_video, generate_dance_video, generate_lyric_video, or generate_effect."),
|
|
34
34
|
message: z
|
|
35
35
|
.string()
|
|
36
36
|
.describe("A human-readable summary of the audio source preparation result."),
|
|
@@ -88,7 +88,7 @@ export function registerUploadAudioTool(server, client, allowLocalFiles = true)
|
|
|
88
88
|
success: true,
|
|
89
89
|
music_id: musicId,
|
|
90
90
|
message: `Audio source ready. Use music_id=${musicId} with ` +
|
|
91
|
-
"
|
|
91
|
+
"generate_music_video, generate_dance_video, generate_lyric_video, or generate_effect.",
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-audio.js","sourceRoot":"","sources":["../../../../src/capabilities/assets/tools/upload-audio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,kBAAkB,GAAG;IACzB,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,KAAK;IACpB,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,MAAM;IACpB,cAAc,EAAE,MAAM;IACtB,WAAW,EAAE,KAAK;IAClB,aAAa,EAAE,KAAK;CACrB,CAAC;AACF,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAGC,EACD,eAAe,GAAG,IAAI;IAEtB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAEhD,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"upload-audio.js","sourceRoot":"","sources":["../../../../src/capabilities/assets/tools/upload-audio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM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AAG,MAAM,MAAM,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;gBACzD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,KAAK,CACX,kBAAkB,cAAc,sDAAsD,CACvF,CAAC;oBACF,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,+BAA+B,CAAC,GAAI,CAAC,CAAC;gBACtC,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,GAAI,CAAC,CAAC;YAC/C,CAAC;YAED,OAAO,WAAW,CAAC;gBACjB,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,OAAO;gBACjB,OAAO,EACL,oCAAoC,OAAO,QAAQ;oBACnD,uFAAuF;aAC1F,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;gBAAS,CAAC;YACT,IAAI,UAAU;gBAAE,MAAM,iBAAiB,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACtE,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -14,7 +14,7 @@ const MAX_IMAGE_BYTES = 10 * 1024 * 1024;
|
|
|
14
14
|
export function registerUploadImageTool(server, client, allowLocalFiles = true) {
|
|
15
15
|
const uploadService = new UploadService(client);
|
|
16
16
|
server.registerTool("upload_image", {
|
|
17
|
-
description: "
|
|
17
|
+
description: "Use this when the user needs to upload one or two image files (PNG/JPG/JPEG, max 10MB each) for Freebeat workflows. Use returned image_urls with generate_music_video, generate_dance_video, or generate_lyric_video for song-driven videos, or pass a single uploaded image URL to generate_effect.reference_image_urls to replace the default list_effects.image_url. Does not generate or edit images.",
|
|
18
18
|
annotations: { title: "Upload images", ...CREATE_TOOL_ANNOTATIONS },
|
|
19
19
|
_meta: { "openai/fileParams": ["files"] },
|
|
20
20
|
outputSchema: {
|
|
@@ -97,7 +97,7 @@ export function registerUploadImageTool(server, client, allowLocalFiles = true)
|
|
|
97
97
|
success: true,
|
|
98
98
|
image_urls: imageUrls,
|
|
99
99
|
message: `Uploaded ${imageUrls.length} image(s). Use image_urls with ` +
|
|
100
|
-
"
|
|
100
|
+
"generate_music_video, generate_dance_video, or generate_lyric_video, or use one uploaded image URL in " +
|
|
101
101
|
"generate_effect.reference_image_urls to replace the default effect image.",
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-image.js","sourceRoot":"","sources":["../../../../src/capabilities/assets/tools/upload-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,kBAAkB,GAAG;IACzB,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,KAAK;CACpB,CAAC;AACF,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAA2E,EAC3E,eAAe,GAAG,IAAI;IAEtB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAEhD,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"upload-image.js","sourceRoot":"","sources":["../../../../src/capabilities/assets/tools/upload-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,kBAAkB,GAAG;IACzB,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,KAAK;CACpB,CAAC;AACF,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAA2E,EAC3E,eAAe,GAAG,IAAI;IAEtB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAEhD,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,WAAW,EACT,2YAA2Y;QAC7Y,WAAW,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,uBAAuB,EAAE;QACnE,KAAK,EAAE,EAAE,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE;QACzC,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC;iBACP,OAAO,CAAC,IAAI,CAAC;iBACb,QAAQ,CAAC,kDAAkD,CAAC;YAC/D,UAAU,EAAE,CAAC;iBACV,KAAK,CACJ,CAAC;iBACE,MAAM,EAAE;iBACR,QAAQ,CAAC,qCAAqC,CAAC,C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,wDAAwD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpG,CAAC;oBACJ,CAAC;oBACD,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;YAED,OAAO,WAAW,CAAC;gBACjB,OAAO,EAAE,IAAI;gBACb,UAAU,EAAE,SAAS;gBACrB,OAAO,EACL,YAAY,SAAS,CAAC,MAAM,iCAAiC;oBAC7D,wGAAwG;oBACxG,2EAA2E;aAC9E,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;gBAAS,CAAC;YACT,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;gBACrC,MAAM,iBAAiB,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -16,8 +16,8 @@ export function registerUploadVideoTool(server, client, allowLocalFiles = true)
|
|
|
16
16
|
const uploadService = new UploadService(client);
|
|
17
17
|
server.registerTool("upload_video", {
|
|
18
18
|
description: allowLocalFiles
|
|
19
|
-
? "
|
|
20
|
-
: "
|
|
19
|
+
? "Use this when the user needs to upload an MP4, MOV, or WebM video for a Freebeat lip-sync workflow from an attachment, local file path, or public HTTPS url. Provide exactly one of file, file_path, or url. Returns a video_url for generate_lip_sync_video. Does not generate a new clip. For song-driven music, dance, or lyric videos, use generate_music_video, generate_dance_video, or generate_lyric_video."
|
|
20
|
+
: "Use this when the user needs to upload an MP4, MOV, or WebM video for a Freebeat lip-sync workflow from an attachment or public HTTPS url. Returns a video_url for generate_lip_sync_video. Does not generate a new clip. For song-driven music, dance, or lyric videos, use generate_music_video, generate_dance_video, or generate_lyric_video.",
|
|
21
21
|
annotations: { title: "Upload video", ...CREATE_TOOL_ANNOTATIONS },
|
|
22
22
|
_meta: { "openai/fileParams": ["file"] },
|
|
23
23
|
inputSchema: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-video.js","sourceRoot":"","sources":["../../../../src/capabilities/assets/tools/upload-video.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,kBAAkB,GAAG;IACzB,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,KAAK;IACxB,YAAY,EAAE,MAAM;CACrB,CAAC;AACF,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAA2E,EAC3E,eAAe,GAAG,IAAI;IAEtB,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAEhD,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,WAAW,EAAE,eAAe;YAC1B,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"upload-video.js","sourceRoot":"","sources":["../../../../src/capabilities/assets/tools/upload-video.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,C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AAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;gBAAS,CAAC;YACT,IAAI,UAAU;gBAAE,MAAM,iBAAiB,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACtE,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 registerCreditTools(server: McpServer, client: Pick<FreebeatApiClient, "getCreditBalance" | "quoteGeneration">): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PAID_TOOLS } from "../../core/paid-tools.js";
|
|
3
|
+
import { formatToolError, jsonContent } from "../../core/response.js";
|
|
4
|
+
import { READ_ONLY_TOOL_ANNOTATIONS } from "../../core/tool-annotations.js";
|
|
5
|
+
export function registerCreditTools(server, client) {
|
|
6
|
+
server.registerTool("get_credit_balance", {
|
|
7
|
+
description: "Read the signed-in Freebeat account's available credit balance. Does not charge credits or start generation.",
|
|
8
|
+
annotations: { title: "Get credit balance", ...READ_ONLY_TOOL_ANNOTATIONS },
|
|
9
|
+
inputSchema: {},
|
|
10
|
+
outputSchema: { credits: z.number().describe("Available Freebeat credits.") },
|
|
11
|
+
}, async () => {
|
|
12
|
+
try {
|
|
13
|
+
return jsonContent(await client.getCreditBalance());
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return formatToolError(error);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
server.registerTool("quote_generation", {
|
|
20
|
+
description: "Call before any paid generation and tell the user the returned price or that it is unavailable. After user approval, pass the quoted credits as max_credits on the paid tool. If a ceiling was set, never omit or raise it to bypass a refusal. Supply the intended tool and its planned input parameters. Reads current Freebeat pricing rules, without starting or charging for generation. Quoted credits are list price before account discounts or allowances. Unavailable means unknown, never free; agent totals depend on stages and retries. For music, check list_music_models for length control before quoting.",
|
|
21
|
+
annotations: { title: "Quote generation", ...READ_ONLY_TOOL_ANNOTATIONS },
|
|
22
|
+
inputSchema: {
|
|
23
|
+
tool: z.enum(PAID_TOOLS).describe("The paid tool to quote."),
|
|
24
|
+
parameters: z.record(z.unknown()).describe("The same input parameters planned for the paid tool, including the model, prompt, duration, and other price-changing options."),
|
|
25
|
+
},
|
|
26
|
+
outputSchema: {
|
|
27
|
+
status: z.enum(["quoted", "unavailable"]),
|
|
28
|
+
credits: z.number().optional(),
|
|
29
|
+
source: z.string(),
|
|
30
|
+
message: z.string(),
|
|
31
|
+
},
|
|
32
|
+
}, async ({ tool, parameters }) => {
|
|
33
|
+
try {
|
|
34
|
+
return jsonContent(await client.quoteGeneration(tool, parameters));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return formatToolError(error);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/capabilities/credits/register.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAG5E,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAuE;IAC5H,MAAM,CAAC,YAAY,CAAC,oBAAoB,EAAE;QACxC,WAAW,EAAE,8GAA8G;QAC3H,WAAW,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,GAAG,0BAA0B,EAAE;QAC3E,WAAW,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C;IAClD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { maxCreditsSchema, creditQuoteSchema } from "../../../core/credit-approval.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { AppError } from "../../../core/errors.js";
|
|
3
4
|
import { normalizeGenerationPrompt } from "../../../core/prompt.js";
|
|
@@ -5,9 +6,10 @@ import { formatToolError, jsonContent } from "../../../core/response.js";
|
|
|
5
6
|
import { CREATE_TOOL_ANNOTATIONS } from "../../../core/tool-annotations.js";
|
|
6
7
|
export function registerGenerateEffectTool(server, client) {
|
|
7
8
|
server.registerTool("generate_effect", {
|
|
8
|
-
description: "
|
|
9
|
+
description: "Before spending credits, call quote_generation with this tool and its planned parameters, then tell the user the price or that it is unavailable. Set max_credits to the user-approved quote or ceiling. A higher or unknown price stops submission; never remove or raise the ceiling without approval. Use this when the user wants an effect-template video from a music_id and exactly one reference image URL. Flow: list_effects -> optional upload_audio -> optional upload_image -> generate_effect -> get_task_status -> get_task_result. By default, use list_effects.image_url. You can also use a single uploaded image URL from upload_image. Only call get_task_result after get_task_status returns completed. For song-driven music, dance, or lyric videos, use generate_music_video, generate_dance_video, or generate_lyric_video.",
|
|
9
10
|
annotations: { title: "Generate effect", ...CREATE_TOOL_ANNOTATIONS },
|
|
10
11
|
outputSchema: {
|
|
12
|
+
quote: creditQuoteSchema.optional(),
|
|
11
13
|
success: z
|
|
12
14
|
.literal(true)
|
|
13
15
|
.describe("Whether the effect task was created successfully."),
|
|
@@ -25,6 +27,7 @@ export function registerGenerateEffectTool(server, client) {
|
|
|
25
27
|
.describe("A human-readable summary of the task creation result."),
|
|
26
28
|
},
|
|
27
29
|
inputSchema: {
|
|
30
|
+
max_credits: maxCreditsSchema,
|
|
28
31
|
effect_id: z.number().int().describe("Effect ID returned by list_effects."),
|
|
29
32
|
music_id: z
|
|
30
33
|
.number()
|
|
@@ -48,7 +51,7 @@ export function registerGenerateEffectTool(server, client) {
|
|
|
48
51
|
.length(1, "reference_image_urls must contain exactly one image URL")
|
|
49
52
|
.describe("Exactly one image URL. Recommended: use list_effects.image_url. You may also use a single uploaded image URL from upload_image."),
|
|
50
53
|
},
|
|
51
|
-
}, async ({ effect_id, music_id, prompt, watermark, reference_image_urls, }) => {
|
|
54
|
+
}, async ({ max_credits, effect_id, music_id, prompt, watermark, reference_image_urls, }) => {
|
|
52
55
|
try {
|
|
53
56
|
const normalizedPrompt = normalizeGenerationPrompt(prompt);
|
|
54
57
|
if (!Number.isInteger(effect_id)) {
|
|
@@ -61,6 +64,7 @@ export function registerGenerateEffectTool(server, client) {
|
|
|
61
64
|
return formatToolError(new AppError("reference_image_urls must contain exactly one image URL", "INVALID_PARAMS"));
|
|
62
65
|
}
|
|
63
66
|
const result = await client.generateEffect({
|
|
67
|
+
max_credits,
|
|
64
68
|
effect_id,
|
|
65
69
|
music_id,
|
|
66
70
|
prompt: normalizedPrompt,
|
|
@@ -69,6 +73,7 @@ export function registerGenerateEffectTool(server, client) {
|
|
|
69
73
|
});
|
|
70
74
|
return jsonContent({
|
|
71
75
|
success: true,
|
|
76
|
+
quote: result.quote,
|
|
72
77
|
task_id: result.task_id,
|
|
73
78
|
task_type: result.task_type,
|
|
74
79
|
status: result.status,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-effect.js","sourceRoot":"","sources":["../../../../src/capabilities/effects/tools/generate-effect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-effect.js","sourceRoot":"","sources":["../../../../src/capabilities/effects/tools/generate-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAEvF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAA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,CAAC,OAAO;gBACvB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,OAAO,EAAE,+DAA+D,MAAM,CAAC,OAAO,oBAAoB;aAC3G,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -14,7 +14,7 @@ function normalizeEffect(effect) {
|
|
|
14
14
|
}
|
|
15
15
|
export function registerListEffectsTool(server, client) {
|
|
16
16
|
server.registerTool("list_effects", {
|
|
17
|
-
description: "
|
|
17
|
+
description: "Use this when the user wants effect templates and the metadata needed to select an effect and create an effect task. Each effect includes a default image_url and default_music_id you can use directly. This lists templates rather than generating a video. For song-driven music, dance, or lyric videos, use generate_music_video, generate_dance_video, or generate_lyric_video.",
|
|
18
18
|
annotations: { title: "List effects", ...READ_ONLY_TOOL_ANNOTATIONS },
|
|
19
19
|
outputSchema: {
|
|
20
20
|
success: z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-effects.js","sourceRoot":"","sources":["../../../../src/capabilities/effects/tools/list-effects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E,SAAS,eAAe,CAAC,MAAsB;IAC7C,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,aAAa;QAC/B,YAAY,EAAE,MAAM,CAAC,kBAAkB;QACvC,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,iBAAiB,EAAE,MAAM,CAAC,QAAQ;QAClC,gBAAgB,EAAE,MAAM,CAAC,OAAO;QAChC,kBAAkB,EAAE,MAAM,CAAC,SAAS;QACpC,YAAY,EAAE,MAAM,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAA8C;IAE9C,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"list-effects.js","sourceRoot":"","sources":["../../../../src/capabilities/effects/tools/list-effects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E,SAAS,eAAe,CAAC,MAAsB;IAC7C,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,aAAa;QAC/B,YAAY,EAAE,MAAM,CAAC,kBAAkB;QACvC,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,iBAAiB,EAAE,MAAM,CAAC,QAAQ;QAClC,gBAAgB,EAAE,MAAM,CAAC,OAAO;QAChC,kBAAkB,EAAE,MAAM,CAAC,SAAS;QACpC,YAAY,EAAE,MAAM,CAAC,WAAW;KACjC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAA8C;IAE9C,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,WAAW,EACT,uXAAuX;QACzX,WAAW,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,0BAA0B,EAAE;QACrE,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC;iBACP,OAAO,CAAC,IAAI,CAAC;iBACb,QAAQ,CAAC,sDAAsD,CAAC;YACnE,OAAO,EAAE,CAAC;iBACP,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;gBACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;gBAC1E,YAAY,EAAE,CAAC,CAAC,MAAM,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