moderate_comment
Set a YouTube comment's moderation status to hold for review, approve, or reject to manage its visibility.
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/tools/comments.ts:64-79 (handler)The MCP tool handler for 'moderate_comment'. Invokes client.moderateComment() with comment_id and moderation_status, then returns a success message.
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}`, }, ], }; }, ); - src/tools/comments.ts:17-22 (schema)Zod input schema for the moderate_comment tool: requires comment_id (string) and moderation_status (enum: heldForReview, published, rejected).
const moderateSchema = { comment_id: z.string(), moderation_status: z.enum(["heldForReview", "published", "rejected"]).describe( "heldForReview hides until approved, published approves, rejected deletes.", ), }; - src/youtube/client.ts:223-228 (helper)YouTubeClient.moderateComment() - makes POST request to YouTube API /comments/setModerationStatus with id and moderationStatus parameters.
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/server.ts:49-49 (registration)Registration - registerCommentTools(s, youtube) is called inside buildServer() to register all comment tools including moderate_comment.
registerCommentTools(s, youtube);