reply_to_comment
Reply to a top-level YouTube comment by providing the comment ID and reply text.
Instructions
Reply to a top-level comment. Requires youtube.force-ssl scope.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parent_id | Yes | Comment ID to reply to (top-level comment.id from list_comments) | |
| text | Yes |
Implementation Reference
- src/tools/comments.ts:47-61 (handler)Handler function for the reply_to_comment tool. Calls client.replyToComment() with parent_id and text, then returns confirmation text.
server.tool( "reply_to_comment", "Reply to a top-level comment. Requires youtube.force-ssl scope.", replySchema, async (args) => { await client.replyToComment(args.parent_id, args.text); return { content: [ { type: "text" as const, text: `Reply posted to ${args.parent_id}`, }, ], }; }, - src/tools/comments.ts:10-15 (schema)Zod schema for reply_to_comment inputs: parent_id (string) and text (string, min 1 character).
const replySchema = { parent_id: z .string() .describe("Comment ID to reply to (top-level comment.id from list_comments)"), text: z.string().min(1), }; - src/tools/comments.ts:47-62 (registration)Registration of reply_to_comment via server.tool() in registerCommentTools function.
server.tool( "reply_to_comment", "Reply to a top-level comment. Requires youtube.force-ssl scope.", replySchema, async (args) => { await client.replyToComment(args.parent_id, args.text); return { content: [ { type: "text" as const, text: `Reply posted to ${args.parent_id}`, }, ], }; }, ); - src/youtube/client.ts:215-221 (helper)YouTubeClient.replyToComment() helper: posts to the YouTube Data API v3 /comments endpoint with parentId and textOriginal.
replyToComment(parentId: string, text: string): Promise<unknown> { return this.dataPost( "/comments", { part: "snippet" }, { snippet: { parentId, textOriginal: text } }, ); }