channels_getChannel
Retrieve detailed information about a YouTube channel by providing its channel ID using the YouTube MCP Server interface.
Instructions
Get information about a YouTube channel
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channelId | Yes | The YouTube channel ID |
Implementation Reference
- src/services/channel.ts:37-52 (handler)The main handler function in ChannelService that fetches YouTube channel details using the YouTube Data API v3.async getChannel({ channelId }: ChannelParams): Promise<any> { try { this.initialize(); const response = await this.youtube.channels.list({ part: ['snippet', 'statistics', 'contentDetails'], id: [channelId] }); return response.data.items?.[0] || null; } catch (error) { throw new Error(`Failed to get channel: ${error instanceof Error ? error.message : String(error)}`); } }
- src/server.ts:99-112 (registration)Tool registration in the ListToolsRequestSchema handler, defining the tool name, description, and input schema.{ name: 'channels_getChannel', description: 'Get information about a YouTube channel', inputSchema: { type: 'object', properties: { channelId: { type: 'string', description: 'The YouTube channel ID', }, }, required: ['channelId'], }, },
- src/server.ts:202-210 (handler)Dispatch handler in the CallToolRequestSchema switch that calls the ChannelService.getChannel and formats the response.case 'channels_getChannel': { const result = await channelService.getChannel(args as unknown as ChannelParams); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
- src/types.ts:54-56 (schema)TypeScript interface defining the input parameters for the channels_getChannel tool.export interface ChannelParams { channelId: string; }