Skip to main content
Glama
getChannelStatistics.ts1.32 kB
import { z } from "zod"; import { BaseTool } from "../base.js"; import { formatSuccess } from "../../utils/responseFormatter.js"; import { channelIdSchema } from "../../utils/validation.js"; import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; export const getChannelStatisticsSchema = z.object({ channelIds: z .array(channelIdSchema) .min(1, "Channel IDs array must contain at least 1 element(s)") .describe("Array of YouTube channel IDs to get statistics for"), }); export class GetChannelStatisticsTool extends BaseTool< typeof getChannelStatisticsSchema > { name = "getChannelStatistics"; description = "Retrieves statistics for multiple channels. Returns detailed metrics including subscriber count, view count, video count, and channel creation date for each channel. Use this when you need to analyze the performance and reach of multiple YouTube channels."; schema = getChannelStatisticsSchema; protected async executeImpl( params: z.infer<typeof getChannelStatisticsSchema> ): Promise<CallToolResult> { const statsPromises = params.channelIds.map((channelId) => this.container.youtubeService.getChannelStatistics(channelId) ); const statisticsResults = await Promise.all(statsPromises); return formatSuccess(statisticsResults); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kirbah/mcp-youtube'

If you have feedback or need assistance with the MCP directory API, please join our Discord server