wave_control_camera
Control PTZ camera movements including pan, tilt, zoom, focus, and recall or store presets by specifying camera ID and action.
Instructions
Control a PTZ camera (pan, tilt, zoom, focus, recall preset)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| camera_id | Yes | The camera ID | |
| action | Yes | Camera control action | |
| pan | No | Pan speed (-1 to 1) | |
| tilt | No | Tilt speed (-1 to 1) | |
| zoom | No | Zoom speed (-1 to 1) | |
| preset_id | No | Preset ID for recall/store |
Implementation Reference
- src/tools/production.ts:122-149 (registration)Registration of the wave_control_camera tool via server.tool() with its schema definition.
server.tool( "wave_control_camera", "Control a PTZ camera (pan, tilt, zoom, focus, recall preset)", { camera_id: z.string().uuid().describe("The camera ID"), action: z .enum(["move", "zoom", "focus", "recall_preset", "store_preset"]) .describe("Camera control action"), pan: z.number().min(-1).max(1).optional().describe("Pan speed (-1 to 1)"), tilt: z.number().min(-1).max(1).optional().describe("Tilt speed (-1 to 1)"), zoom: z.number().min(-1).max(1).optional().describe("Zoom speed (-1 to 1)"), preset_id: z.string().optional().describe("Preset ID for recall/store"), }, async ({ camera_id, action, pan, tilt, zoom, preset_id }) => { const payload: Record<string, unknown> = { type: action }; if (pan !== undefined) payload["pan"] = pan; if (tilt !== undefined) payload["tilt"] = tilt; if (zoom !== undefined) payload["zoom"] = zoom; if (preset_id !== undefined) payload["presetId"] = preset_id; const res = await waveFetch(`/api/v1/cameras/${camera_id}/control`, { method: "POST", body: JSON.stringify(payload), }); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, ); - src/tools/production.ts:135-148 (handler)Handler function that builds a payload and sends a POST request to /api/v1/cameras/${camera_id}/control to control a PTZ camera.
async ({ camera_id, action, pan, tilt, zoom, preset_id }) => { const payload: Record<string, unknown> = { type: action }; if (pan !== undefined) payload["pan"] = pan; if (tilt !== undefined) payload["tilt"] = tilt; if (zoom !== undefined) payload["zoom"] = zoom; if (preset_id !== undefined) payload["presetId"] = preset_id; const res = await waveFetch(`/api/v1/cameras/${camera_id}/control`, { method: "POST", body: JSON.stringify(payload), }); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, - src/tools/production.ts:125-134 (schema)Zod schema defining the input parameters: camera_id, action (enum), pan, tilt, zoom, preset_id.
{ camera_id: z.string().uuid().describe("The camera ID"), action: z .enum(["move", "zoom", "focus", "recall_preset", "store_preset"]) .describe("Camera control action"), pan: z.number().min(-1).max(1).optional().describe("Pan speed (-1 to 1)"), tilt: z.number().min(-1).max(1).optional().describe("Tilt speed (-1 to 1)"), zoom: z.number().min(-1).max(1).optional().describe("Zoom speed (-1 to 1)"), preset_id: z.string().optional().describe("Preset ID for recall/store"), }, - src/tools/production.ts:5-19 (helper)waveFetch helper function used by the handler to make authenticated HTTP requests.
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/server.ts:24-24 (registration)Registration call in the main server entry point that wires up the production tools.
registerProductionTools(server);