search_channel_videos
Search YouTube videos within a specific channel by query. Input channel and search terms to retrieve matching videos from that channel. Ideal for locating a particular video based on topic or title.
Instructions
Search for specific videos within a single YouTube channel. Restricts results to the given channel. Use after resolve_channel if starting from a handle. Useful for 'find Karpathy's video about backpropagation' style queries.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes | @handle, channel URL, or UC... channel ID. | |
| q | Yes | Search query (matched against video title and description within the channel). | |
| limit | No | Max results (1-50, default 30). |
Implementation Reference
- src/index.js:245-271 (registration)The tool 'search_channel_videos' is registered in the TOOLS array (line 246) with its name, description, annotations, and inputSchema. It requires 'channel' and 'q' parameters, with an optional 'limit' (1-50). The actual handler logic is delegated via the generic callUpstream() proxy to the upstream SubDownload API.
{ name: "search_channel_videos", description: "Search for specific videos within a single YouTube channel. Restricts results to the given channel. Use after resolve_channel if starting from a handle. Useful for 'find Karpathy's video about backpropagation' style queries.", annotations: { title: "Search Channel Videos", ...ANN.YT_READ }, inputSchema: { type: "object", properties: { channel: { type: "string", description: "@handle, channel URL, or UC... channel ID.", minLength: 1, }, q: { type: "string", description: "Search query (matched against video title and description within the channel).", minLength: 1, }, limit: { type: "number", description: "Max results (1-50, default 30).", minimum: 1, maximum: 50, }, }, required: ["channel", "q"], }, - src/index.js:450-462 (handler)Generic CallToolRequestSchema handler: all tools (including search_channel_videos) are forwarded to the upstream MCP server via callUpstream(), which sends a JSON-RPC tools/call request to the SubDownload API.
server.setRequestHandler(CallToolRequestSchema, async (request) => { try { return await callUpstream( request.params.name, request.params.arguments || {} ); } catch (err) { return { content: [{ type: "text", text: err.message || String(err) }], isError: true, }; } }); - src/index.js:408-441 (helper)The callUpstream() helper function that proxies all tool calls (including search_channel_videos) to the upstream SubDownload MCP endpoint with the Bearer token.
async function callUpstream(name, args) { if (!API_KEY) { throw new Error( "SUBDOWNLOAD_API_KEY env var is not set. Get one at https://subdownload.com/account, then run with -e SUBDOWNLOAD_API_KEY=<your-key>." ); } const res = await fetch(UPSTREAM_URL, { method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json, text/event-stream", Authorization: `Bearer ${API_KEY}`, }, body: JSON.stringify({ jsonrpc: "2.0", id: Date.now(), method: "tools/call", params: { name, arguments: args }, }), }); const text = await res.text(); let body; try { body = JSON.parse(text); } catch { throw new Error( `Upstream returned non-JSON response (HTTP ${res.status}): ${text.slice(0, 200)}` ); } if (body.error) { throw new Error(body.error.message || JSON.stringify(body.error)); } return body.result; }