Skip to main content
Glama

get_shorts_analytics

Retrieve YouTube Analytics data filtered to Shorts content for your authenticated channel. Specify date range and metrics to analyze Shorts performance.

Instructions

Query YouTube Analytics restricted to Shorts for the authenticated channel. Applies filters=creatorContentType==SHORTS on top of the usual start_date/end_date/metrics/dimensions knobs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
start_dateYesYYYY-MM-DD start date (inclusive).
end_dateYesYYYY-MM-DD end date (inclusive).
metricsNoComma-separated YouTube Analytics metrics.views,estimatedMinutesWatched,averageViewDuration,subscribersGained
dimensionsNoOptional dimensions, e.g. 'day' for a time series.
sortNo
max_resultsNo

Implementation Reference

  • The tool handler for 'get_shorts_analytics' — calls client.analyticsQuery() with a SHORTS filter and returns the results as JSON.
    server.tool(
      "get_shorts_analytics",
      "Query YouTube Analytics restricted to Shorts for the authenticated channel. Applies filters=creatorContentType==SHORTS on top of the usual start_date/end_date/metrics/dimensions knobs.",
      getShortsAnalyticsSchema,
      async (args) => {
        const res = await client.analyticsQuery({
          startDate: args.start_date,
          endDate: args.end_date,
          metrics: args.metrics,
          dimensions: args.dimensions,
          filters: "creatorContentType==SHORTS",
          sort: args.sort,
          maxResults: args.max_results,
        });
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(res, null, 2),
            },
          ],
        };
      },
    );
  • Input schema for get_shorts_analytics: start_date, end_date, metrics, dimensions, sort, max_results.
    const getShortsAnalyticsSchema = {
      start_date: z
        .string()
        .describe("YYYY-MM-DD start date (inclusive)."),
      end_date: z
        .string()
        .describe("YYYY-MM-DD end date (inclusive)."),
      metrics: z
        .string()
        .default("views,estimatedMinutesWatched,averageViewDuration,subscribersGained")
        .describe("Comma-separated YouTube Analytics metrics."),
      dimensions: z
        .string()
        .optional()
        .describe("Optional dimensions, e.g. 'day' for a time series."),
      sort: z.string().optional(),
      max_results: z.number().int().min(1).max(500).optional(),
    };
  • Function registerShortsTools() that calls server.tool('get_shorts_analytics', ...) to register the tool.
    export function registerShortsTools(
      server: McpServer,
      client: YouTubeClient,
    ): void {
      server.tool(
        "list_my_shorts",
        "List your recent Shorts — scans the most recent uploads and filters to videos ≤60s. Useful when the Data API doesn't expose a direct Shorts filter.",
  • src/server.ts:52-52 (registration)
    Call to registerShortsTools(s, youtube) from the main server setup.
    registerShortsTools(s, youtube);
  • analyticsQuery() method on YouTubeClient that builds and sends the YouTube Analytics API request.
    async analyticsQuery(params: {
      startDate: string;
      endDate: string;
      metrics: string;
      dimensions?: string;
      filters?: string;
      sort?: string;
      maxResults?: number;
    }): Promise<AnalyticsResponse> {
      return this.analyticsGet<AnalyticsResponse>("/reports", {
        ids: "channel==MINE",
        "start-date": params.startDate,
        "end-date": params.endDate,
        metrics: params.metrics,
        dimensions: params.dimensions,
        filters: params.filters,
        sort: params.sort,
        maxResults: params.maxResults ? String(params.maxResults) : undefined,
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions authentication ('for the authenticated channel') and the filter, but does not disclose behavioral traits like pagination, rate limits, or return format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with main purpose. Efficiently communicates the core functionality without excessive verbosity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides adequate context for a query tool but lacks details about return values and behavioral aspects that could be expected from sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 67%, so baseline is 3. The description adds that the tool applies a Shorts filter on top of usual knobs, but does not elaborate on parameters like sort or max_results beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it queries YouTube Analytics restricted to Shorts for the authenticated channel, using a specific filter. It distinguishes itself from sibling tools like query_channel_analytics, which likely covers all content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for Shorts analytics by mentioning the filter, and the sibling set includes query_channel_analytics for general analytics. However, it does not explicitly state when not to use or provide alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/miller-joe/youtube-mcp'

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