channels_getChannel
Retrieve YouTube channel information using a channel ID to access details like statistics, content, and metadata from the YouTube Data API.
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)Core implementation of channel retrieval using YouTube Data API v3 channels.list endpoint.async getChannel({ channelId }: ChannelParams): Promise<unknown> { 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-utils.ts:200-219 (registration)MCP tool registration including schema definition and wrapper handler delegating to ChannelService.server.registerTool( 'channels_getChannel', { title: 'Get Channel Information', description: 'Get information about a YouTube channel', annotations: { readOnlyHint: true, idempotentHint: true }, inputSchema: { channelId: z.string().describe('The YouTube channel ID'), }, }, async ({ channelId }) => { const result = await channelService.getChannel({ channelId }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } );
- src/types.ts:54-56 (schema)TypeScript interface defining input parameters for channel operations, used by ChannelService.export interface ChannelParams { channelId: string; }