resolve_channel
Convert any YouTube handle, URL, or ID into canonical channel info including ID, name, stats, and avatar. Use this to obtain a channel ID for further operations.
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:190-206 (schema)Schema definition for the 'resolve_channel' tool, declaring its input parameter (a string 'input' for @handle, channel URL, video URL, or UC... channel ID) and description.
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:408-441 (handler)The callUpstream function that serves as the handler for all tools, including resolve_channel. It forwards the tool name and arguments to the upstream MCP server (api.subdownload.com/mcp) via a POST request with Bearer auth.
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:450-462 (registration)Registration of the CallToolRequestSchema handler which dispatches all tool calls (including resolve_channel) to 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:448-448 (registration)Registration of the ListToolsRequestSchema handler that returns the TOOLS array, which includes the resolve_channel tool definition.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));