wave_moderate_chat
Moderate chat messages in live streams by blocking, flagging, or allowing them with a reason.
Instructions
Moderate a chat message in a live stream (block, flag, or allow)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stream_id | Yes | The stream ID | |
| message_id | Yes | The chat message ID to moderate | |
| action | Yes | Moderation action | |
| reason | No | Reason for moderation action |
Implementation Reference
- src/tools/production.ts:160-170 (handler)The async handler function that executes the moderate_chat logic. It calls waveFetch to POST to /api/v1/streams/{stream_id}/chat/{message_id}/moderate with action and reason.
async ({ stream_id, message_id, action, reason }) => { const res = await waveFetch( `/api/v1/streams/${stream_id}/chat/${message_id}/moderate`, { method: "POST", body: JSON.stringify({ action, reason: reason ?? "" }), }, ); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, - src/tools/production.ts:154-159 (schema)Input schema for wave_moderate_chat: stream_id (uuid), message_id (string), action (enum: block/flag/allow), reason (optional string max 500 chars).
{ stream_id: z.string().uuid().describe("The stream ID"), message_id: z.string().describe("The chat message ID to moderate"), action: z.enum(["block", "flag", "allow"]).describe("Moderation action"), reason: z.string().max(500).optional().describe("Reason for moderation action"), }, - src/tools/production.ts:151-171 (registration)The server.tool() call that registers 'wave_moderate_chat' with its description, schema, and handler.
server.tool( "wave_moderate_chat", "Moderate a chat message in a live stream (block, flag, or allow)", { stream_id: z.string().uuid().describe("The stream ID"), message_id: z.string().describe("The chat message ID to moderate"), action: z.enum(["block", "flag", "allow"]).describe("Moderation action"), reason: z.string().max(500).optional().describe("Reason for moderation action"), }, async ({ stream_id, message_id, action, reason }) => { const res = await waveFetch( `/api/v1/streams/${stream_id}/chat/${message_id}/moderate`, { method: "POST", body: JSON.stringify({ action, reason: reason ?? "" }), }, ); if (!res.ok) return errorContent(res.status, res.body); return textContent(res.body); }, ); - src/server.ts:24-24 (registration)Where registerProductionTools(server) is called to register the tool on the MCP server.
registerProductionTools(server); - src/tools/production.ts:5-19 (helper)The waveFetch helper function 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 }; }