moderate_comment
Update a YouTube comment's moderation status to held for review, published, or rejected.
Instructions
Change the moderation status of a comment: heldForReview (hide pending approval), published (approve), or rejected (delete).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment_id | Yes | ||
| moderation_status | Yes | heldForReview hides until approved, published approves, rejected deletes. |
Implementation Reference
- src/youtube/client.ts:223-228 (handler)YouTubeClient.moderateComment() - Makes a POST request to YouTube's comments/setModerationStatus endpoint with the comment ID and moderation status.
moderateComment(commentId: string, moderationStatus: "heldForReview" | "published" | "rejected"): Promise<void> { const url = new URL(`${DATA_API}/comments/setModerationStatus`); url.searchParams.set("id", commentId); url.searchParams.set("moderationStatus", moderationStatus); return this.request<void>(url.toString(), { method: "POST" }); } - src/tools/comments.ts:17-22 (schema)Zod schema defining the input parameters for moderate_comment: comment_id (string) and moderation_status (enum).
const moderateSchema = { comment_id: z.string(), moderation_status: z.enum(["heldForReview", "published", "rejected"]).describe( "heldForReview hides until approved, published approves, rejected deletes.", ), }; - src/tools/comments.ts:64-79 (registration)Registration of the 'moderate_comment' tool on the MCP server, with its description, schema, and handler callback.
server.tool( "moderate_comment", "Change the moderation status of a comment: heldForReview (hide pending approval), published (approve), or rejected (delete).", moderateSchema, async (args) => { await client.moderateComment(args.comment_id, args.moderation_status); return { content: [ { type: "text" as const, text: `Set moderation status of ${args.comment_id} to ${args.moderation_status}`, }, ], }; }, );