wave_show_graphic
Show, hide, or update an HTML5 graphics overlay on a video production using a graphic template ID and data bindings.
Instructions
Show or hide an HTML5 graphics overlay on a production
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| production_id | Yes | The production ID | |
| graphic_id | Yes | The graphic template ID | |
| action | Yes | Action to perform | |
| data | No | Data bindings for the graphic template |
Implementation Reference
- src/tools/production.ts:97-120 (registration)Registration and full implementation of the wave_show_graphic tool. Registered via server.tool() with schema (production_id, graphic_id, action, data) and handler that POSTs to /api/v1/studio/productions/{production_id}/graphics/{graphic_id}.
server.tool( "wave_show_graphic", "Show or hide an HTML5 graphics overlay on a production", { production_id: z.string().uuid().describe("The production ID"), graphic_id: z.string().describe("The graphic template ID"), action: z.enum(["show", "hide", "update"]).describe("Action to perform"), data: z .record(z.string(), z.unknown()) .optional() .describe("Data bindings for the graphic template"), }, async ({ production_id, graphic_id, action, data }) => { const res = await waveFetch( `/api/v1/studio/productions/${production_id}/graphics/${graphic_id}`, { method: "POST", body: JSON.stringify({ action, data: data ?? {} }), }, ); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, ); - src/tools/production.ts:100-108 (schema)Zod schema for wave_show_graphic: production_id (UUID), graphic_id (string), action (enum: show/hide/update), data (optional record of string to unknown).
{ production_id: z.string().uuid().describe("The production ID"), graphic_id: z.string().describe("The graphic template ID"), action: z.enum(["show", "hide", "update"]).describe("Action to perform"), data: z .record(z.string(), z.unknown()) .optional() .describe("Data bindings for the graphic template"), }, - src/tools/production.ts:109-119 (handler)Handler function: sends POST request to WAVE API graphics endpoint with action and data payload, returns text or error response.
async ({ production_id, graphic_id, action, data }) => { const res = await waveFetch( `/api/v1/studio/productions/${production_id}/graphics/${graphic_id}`, { method: "POST", body: JSON.stringify({ action, data: data ?? {} }), }, ); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, - src/tools/production.ts:5-19 (helper)Helper waveFetch function used by the handler to call the WAVE API with authentication headers.
async function waveFetch( path: string, init?: RequestInit, ): Promise<{ ok: boolean; status: number; body: string }> { const url = `${getBaseUrl()}${path}`; const res = await fetch(url, { ...init, headers: { ...getAuthHeaders(), ...init?.headers, }, }); const body = await res.text(); return { ok: res.ok, status: res.status, body }; } - src/tools/production.ts:21-30 (helper)Helper functions textContent and errorContent used by the handler to format successful and error responses.
function textContent(text: string): { content: Array<{ type: "text"; text: string }> } { return { content: [{ type: "text" as const, text }] }; } function errorContent( status: number, body: string, ): { content: Array<{ type: "text"; text: string }> } { return textContent(`Error ${status}: ${body}`); }