Skip to main content
Glama
tuitamogamer-gpt

youtube-mcp-server

Run Analytics Query

youtube_run_analytics_query
Read-onlyIdempotent

Run flexible YouTube Analytics queries to retrieve metrics like views and watch time with custom dimensions, filters, and date ranges.

Instructions

Execute a flexible YouTube Analytics API query against the authenticated channel. Supports any combination of metrics, dimensions, filters, and sort orders supported by the YouTube Analytics API v2. startDate and endDate default to the last 28 days when omitted.

Args:

  • metrics (required): Comma-separated metric names, e.g. "views,estimatedMinutesWatched,likes".

  • startDate (optional): Inclusive start date in YYYY-MM-DD format. Defaults to 28 days ago.

  • endDate (optional): Inclusive end date in YYYY-MM-DD format. Defaults to today.

  • dimensions (optional): Comma-separated dimension names, e.g. "day", "video", "country".

  • filters (optional): Semicolon-separated filter expressions, e.g. "video==VIDEO_ID".

  • sort (optional): Comma-separated sort keys. Prefix with - for descending, e.g. "-views".

  • maxResults (optional): Maximum rows to return (1–200).

  • currency (optional): ISO 4217 currency code for monetary metrics, e.g. "EUR". Defaults to "USD".

  • response_format (optional): "markdown" (default) or "json".

Returns (JSON shape):

{
  "columns": ["day", "views", "estimatedMinutesWatched"],
  "rows": [["2025-01-01", 1234, 5678], ...]
}

Examples:

  • "Show me daily views for the last 7 days" → metrics: "views", dimensions: "day", startDate: "2025-01-01", endDate: "2025-01-07".

  • "Top traffic sources by watch time" → metrics: "views,estimatedMinutesWatched", dimensions: "insightTrafficSourceType", sort: "-estimatedMinutesWatched".

Errors:

  • 400: invalid metric/dimension combination — check the Analytics API docs for valid pairings.

  • 403: missing scope or channel not accessible — re-run npm run auth.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricsYesComma-separated metric names required by the Analytics API, e.g. "views,estimatedMinutesWatched,likes".
startDateNoInclusive start date in YYYY-MM-DD format. Defaults to 28 days ago when omitted.
endDateNoInclusive end date in YYYY-MM-DD format. Defaults to today when omitted.
dimensionsNoComma-separated dimension names, e.g. "day", "video", "country". Optional.
filtersNoSemicolon-separated filter expressions, e.g. "video==VIDEO_ID;country==US".
sortNoComma-separated sort keys. Prefix with "-" for descending order, e.g. "-views".
maxResultsNoMaximum number of rows to return (1–200).
currencyNoISO 4217 three-letter currency code for financial metrics, e.g. "USD" (default), "EUR".
response_formatNoOutput format: "markdown" (default) for a human-readable table, "json" for the raw structured payload.markdown
Behavior4/5

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

Annotations already provide readOnly, destructive, idempotent, and openWorld hints. The description adds valuable context: return shape (columns and rows), default date range, error codes, and example queries. No contradictions.

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

Conciseness5/5

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

The description is well-structured: purpose, defaults, parameter list, return format, examples, errors. Every section is necessary and no redundant information. Front-loaded with key purpose.

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

Completeness5/5

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

For a complex tool with 9 parameters and no output schema, the description covers all aspects: parameter details, defaults, return shape, error handling, and usage examples. It fully equips an agent to use the tool correctly.

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

Parameters4/5

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

Schema has 100% coverage, so baseline is 3. The description adds value with concrete examples, error scenarios, and format details (e.g., default currency, markdown vs json) that go beyond the schema descriptions.

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 executes a YouTube Analytics API query against the authenticated channel, distinguishing it from sibling tools that handle videos, playlists, comments, etc. Specific verb 'Execute' and resource 'Analytics API query' provide high clarity.

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 explains flexible query support, defaults, and provides examples, but does not explicitly contrast with sibling analytics tools like `youtube_audience_demographics` or `youtube_revenue`, leaving some ambiguity about when to use this generic query vs specialized tools.

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/tuitamogamer-gpt/youtube-mcp-server'

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