Skip to main content
Glama

trending_all

Discover trending movies, TV shows, and people by time period to analyze current popularity patterns and generate media recommendations.

Instructions

Retrieves trending content across movies, TV shows, and people. Input: time_window (required: day|week), page (optional), language (optional ISO 639-1), region (optional ISO 3166-1), include_adult (optional boolean). Output: JSON with paginated trending results. Purpose: Discover currently popular media for trend analysis and recommendations by AI agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_adultNo
languageNo
pageNo
regionNo
time_windowYesTime window

Implementation Reference

  • The core handler function for the 'trending_all' tool. It takes parameters like time_window (day/week), page, language, region, include_adult, calls tmdbFetch to get trending data from TMDB API endpoint /trending/all/{time_window}, and returns the JSON response formatted as MCP content.
    handler: async ({time_window, page, language, region, include_adult}) => { const data = await tmdbFetch(`/trending/all/${time_window}`, {page, language, region, include_adult}); return {content: [{type: 'text', text: JSON.stringify(data, null, 2)}]}; }
  • The input schema for the 'trending_all' tool, defining validation for parameters: time_window (required enum day/week), optional page (number >=1), language (string), region (string), include_adult (boolean).
    inputSchema: { type: "object", properties: { time_window: {type: "string", enum: ["day", "week"], description: "Time window"}, page: {type: "number", minimum: 1}, language: {type: "string"}, region: {type: "string"}, include_adult: {type: "boolean"} }, required: ["time_window"], additionalProperties: false
  • The full tool registration object for 'trending_all' within the 'tools' array, which is used by MCP server handlers for listing and calling tools.
    { name: "trending_all", description: "Retrieves trending content across movies, TV shows, and people. Input: time_window (required: day|week), page (optional), language (optional ISO 639-1), region (optional ISO 3166-1), include_adult (optional boolean). Output: JSON with paginated trending results. Purpose: Discover currently popular media for trend analysis and recommendations by AI agents.", inputSchema: { type: "object", properties: { time_window: {type: "string", enum: ["day", "week"], description: "Time window"}, page: {type: "number", minimum: 1}, language: {type: "string"}, region: {type: "string"}, include_adult: {type: "boolean"} }, required: ["time_window"], additionalProperties: false }, handler: async ({time_window, page, language, region, include_adult}) => { const data = await tmdbFetch(`/trending/all/${time_window}`, {page, language, region, include_adult}); return {content: [{type: 'text', text: JSON.stringify(data, null, 2)}]}; } },
  • Shared helper function tmdbFetch used by the trending_all handler (and all tools) to make authenticated API calls to TMDB via proxy, handling URL params, fetch, error checking, and JSON parsing.
    async function tmdbFetch(path, params = {}) { if (!TMDB_AUTH_TOKEN) { throw new Error("TMDB authorization token is not configured"); } const url = new URL(TMDB_BASE + path); Object.entries(params).forEach(([k, v]) => { if (v !== undefined && v !== null && v !== "") url.searchParams.set(k, String(v)); }); const res = await fetch(url, { headers: { Accept: "application/json", Authorization: TMDB_AUTH_TOKEN, }, }); if (!res.ok) { const text = await res.text().catch(() => ""); throw new Error(`TMDB request failed ${res.status}: ${text}`); } return res.json(); }

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/drakonkat/wizzy-mcp-tmdb'

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