delete_caption
Delete a caption track from a YouTube video by specifying its track ID. Retrieve the ID using list_captions tool.
Instructions
Delete a caption track by ID. Use list_captions to find the track ID first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| caption_id | Yes | Caption track ID to delete. |
Implementation Reference
- src/tools/captions.ts:119-134 (handler)The tool handler function for 'delete_caption'. It calls client.deleteCaption(args.caption_id) and returns a success message.
server.tool( "delete_caption", "Delete a caption track by ID. Use list_captions to find the track ID first.", deleteCaptionSchema, async (args) => { await client.deleteCaption(args.caption_id); return { content: [ { type: "text" as const, text: `Deleted caption track ${args.caption_id}.`, }, ], }; }, ); - src/tools/captions.ts:42-44 (schema)The Zod schema for delete_caption input: requires a caption_id string.
const deleteCaptionSchema = { caption_id: z.string().describe("Caption track ID to delete."), }; - src/server.ts:51-51 (registration)Registration of the caption tools (including delete_caption) onto the MCP server.
registerCaptionTools(s, youtube); - src/youtube/client.ts:292-296 (helper)YouTube client helper method that performs the DELETE API call to remove a caption track by ID.
deleteCaption(captionId: string): Promise<void> { const url = new URL(`${DATA_API}/captions`); url.searchParams.set("id", captionId); return this.request<void>(url.toString(), { method: "DELETE" }); }