wave_switch_camera
Switch the live program output to a different camera or source in a Cloud Switcher session with customizable transitions.
Instructions
Switch the live program output to a different camera/source in a Cloud Switcher session
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| switcher_id | Yes | The Cloud Switcher session ID | |
| source_id | Yes | The source to switch to (e.g., cam_1, screen_share) | |
| transition | No | Transition type (default: cut) | |
| duration_ms | No | Transition duration in ms (default: 0 for cut) |
Implementation Reference
- src/tools/production.ts:51-63 (handler)Handler function for wave_switch_camera that POSTs to /api/v1/switcher/{switcher_id}/control with the switch payload
async ({ switcher_id, source_id, transition, duration_ms }) => { const res = await waveFetch(`/api/v1/switcher/${switcher_id}/control`, { method: "POST", body: JSON.stringify({ type: "switch", sourceId: source_id, transition: transition ?? "cut", durationMs: duration_ms ?? 0, }), }); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, - src/tools/production.ts:36-50 (schema)Zod schema defining input parameters: switcher_id (UUID), source_id (string), optional transition (enum), optional duration_ms (0-5000)
{ switcher_id: z.string().uuid().describe("The Cloud Switcher session ID"), source_id: z.string().describe("The source to switch to (e.g., cam_1, screen_share)"), transition: z .enum(["cut", "mix", "wipe", "dve"]) .optional() .describe("Transition type (default: cut)"), duration_ms: z .number() .int() .min(0) .max(5000) .optional() .describe("Transition duration in ms (default: 0 for cut)"), }, - src/tools/production.ts:33-64 (registration)Tool registration using server.tool() in registerProductionTools, exported and called from src/server.ts
server.tool( "wave_switch_camera", "Switch the live program output to a different camera/source in a Cloud Switcher session", { switcher_id: z.string().uuid().describe("The Cloud Switcher session ID"), source_id: z.string().describe("The source to switch to (e.g., cam_1, screen_share)"), transition: z .enum(["cut", "mix", "wipe", "dve"]) .optional() .describe("Transition type (default: cut)"), duration_ms: z .number() .int() .min(0) .max(5000) .optional() .describe("Transition duration in ms (default: 0 for cut)"), }, async ({ switcher_id, source_id, transition, duration_ms }) => { const res = await waveFetch(`/api/v1/switcher/${switcher_id}/control`, { method: "POST", body: JSON.stringify({ type: "switch", sourceId: source_id, transition: transition ?? "cut", durationMs: duration_ms ?? 0, }), }); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, ); - src/tools/production.ts:5-19 (helper)Local waveFetch utility used by the handler to make authenticated HTTP requests to the WAVE API
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 }; }