resolve_channel
Resolve a YouTube @handle, channel URL, video URL, or channel ID into canonical channel information: ID, name, handle, subscriber count, video count, and avatar. Obtain the channel ID needed for other channel-scoped tools.
Instructions
Resolve a YouTube @handle, channel URL, video URL, or raw channel ID into canonical channel info (channel ID, name, handle, subscriber count, video count, avatar). Call this first when you only have a handle or URL but need a channel ID for the other channel-scoped tools.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | @handle (e.g. '@MrBeast'), channel URL, video URL, or UC... channel ID. All common forms are accepted. |
Implementation Reference
- src/index.js:189-206 (schema)Tool definition/schema for 'resolve_channel' in the TOOLS array. Declares name, description, annotations, and inputSchema (accepts an 'input' string: @handle, URL, or channel ID).
{ name: "resolve_channel", description: "Resolve a YouTube @handle, channel URL, video URL, or raw channel ID into canonical channel info (channel ID, name, handle, subscriber count, video count, avatar). Call this first when you only have a handle or URL but need a channel ID for the other channel-scoped tools.", annotations: { title: "Resolve YouTube Channel", ...ANN.YT_READ }, inputSchema: { type: "object", properties: { input: { type: "string", description: "@handle (e.g. '@MrBeast'), channel URL, video URL, or UC... channel ID. All common forms are accepted.", minLength: 1, }, }, required: ["input"], }, }, - src/index.js:450-462 (handler)Generic handler that forwards any tool call (including 'resolve_channel') to the upstream MCP server via callUpstream().
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)Generic upstream proxy function that forwards tool calls to https://api.subdownload.com/mcp with authentication.
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; } - src/index.js:448-448 (registration)Tool registration via ListToolsRequestSchema — returns the TOOLS array (which includes resolve_channel) when the client lists tools.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));