An AI assistant that creates a video has to do more than call a model. It needs to handle user intent, authorized image inputs, account credits, an asynchronous job, and the possibility that a request fails or its response is lost. Here is the workflow we use as the basis for the MCP integration of AI Rap Generators, a product I work on.
Separate planning from spending
The assistant should first identify whether the user wants text ideas or a finished video. A request for a rap name or lyric draft should not automatically start a render. For an original duo video, ask for two portrait URLs and a theme or occasion. People shown must be consenting adults, and the user must have permission to use the photos.
Our remote endpoint is https://airapgenerators.com/api/mcp, using Streamable HTTP. Calls require an account API key passed as a bearer token. Keep the key out of prompts, logs, screenshots and source control.
Model the workflow as explicit steps
-
Inspect the balance. Call
get_creditsand report the available balance. An original 15-second duo video costs 10 credits. Video generation is paid; check pricing for current terms. - Confirm the input boundary. The MCP video tool accepts exactly two publicly accessible HTTPS image URLs. It cannot upload private attachments or local files. If the user cannot provide appropriate URLs, use the website upload flow instead.
-
Offer a stage. Call
list_rap_stageswhen the user needs the available options. -
Create only on request. Once the user has requested a video and accepted the credit cost, call
create_rap_video. Save and show the returned task ID. -
Poll the task. Call
get_video_statusno more than once every three seconds. A task can take time: only present the result URL when the status indicates success.
This separation gives the assistant a chance to explain what it is about to do before a paid side effect. It also makes the user-visible state clearer: preparing inputs, waiting for a task, or delivering the output.
An important failure case: an unknown outcome
If a create request times out, a client cannot assume the server never received it. Blindly retrying a paid action can lead to an unwanted duplicate. A cautious client should tell the user the outcome is unknown and check the account or task state before issuing another create request. An idempotency key can help when an API explicitly supports it; do not assume that every endpoint has one.
The integration returns reserved credits for failed renders. That does not remove the need to distinguish a reported failure from a response lost in transit.
Scope the media and the promise
The video MCP flow currently creates original duo videos. It does not upload images or create the website's solo and meme templates. A lyric draft can help the creative process, but the final generated verse may differ: a developer should not promise exact reproduction of a separate draft.
An example user request is: “Make a birthday-themed duo rap using these two image URLs. Check my credits and tell me the cost first.” The assistant can then map that request onto the individual tools without treating a generated video as an immediate text reply.
The MCP guide and API documentation cover setup and supported inputs. This article describes the documented flow; it does not claim a production end-to-end render was performed for this example.
Top comments (0)