Skip to main content
Glama
icyrainz

XMLTV MCP Server

by icyrainz

get_schedule

Retrieve upcoming TV programming schedule for a specific channel, allowing users to view listings for the next 24 hours or custom timeframe.

Instructions

Get upcoming schedule for a specific channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYesChannel ID (e.g., C1.49.tunarr.com)
hours_aheadNoNumber of hours to look ahead (default: 24)

Implementation Reference

  • The core handler function that implements the get_schedule tool logic: fetches XMLTV data, filters and sorts programmes for the specified channel within the given hours ahead, and maps to the output format.
    async function getSchedule(channelId: string, hoursAhead: number = 24) {
      const data = await getXmltvData();
      const now = new Date();
      const endTime = new Date(now.getTime() + hoursAhead * 60 * 60 * 1000);
    
      const schedule = data.tv.programme
        .filter(prog => {
          if (prog.channel !== channelId) return false;
          const start = parseXmltvDate(prog.start);
          return start >= now && start <= endTime;
        })
        .sort((a, b) => a.start.localeCompare(b.start))
        .map(prog => ({
          title: prog.title,
          subtitle: prog["sub-title"],
          description: prog.desc,
          start: prog.start,
          stop: prog.stop,
          episodeNum: Array.isArray(prog["episode-num"])
            ? prog["episode-num"][0]
            : prog["episode-num"],
          rating: Array.isArray(prog.rating)
            ? prog.rating[0]?.value
            : prog.rating?.value,
          date: prog.date,
        }));
    
      return schedule;
    }
  • Input schema for the get_schedule tool, defining required channel_id and optional hours_ahead parameters.
    inputSchema: {
      type: "object",
      properties: {
        channel_id: {
          type: "string",
          description: "Channel ID (e.g., C1.49.tunarr.com)",
        },
        hours_ahead: {
          type: "number",
          description: "Number of hours to look ahead (default: 24)",
        },
      },
      required: ["channel_id"],
    },
  • src/index.ts:280-297 (registration)
    Tool registration entry in the tools array, which is returned by ListToolsRequest handler.
    {
      name: "get_schedule",
      description: "Get upcoming schedule for a specific channel",
      inputSchema: {
        type: "object",
        properties: {
          channel_id: {
            type: "string",
            description: "Channel ID (e.g., C1.49.tunarr.com)",
          },
          hours_ahead: {
            type: "number",
            description: "Number of hours to look ahead (default: 24)",
          },
        },
        required: ["channel_id"],
      },
    },
  • MCP protocol handler case that extracts arguments, calls the getSchedule function, and formats the response for CallToolRequest.
    case "get_schedule": {
      const { channel_id, hours_ahead } = request.params.arguments as {
        channel_id: string;
        hours_ahead?: number;
      };
      const schedule = await getSchedule(channel_id, hours_ahead);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(schedule, null, 2),
          },
        ],
      };
    }
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 of behavioral disclosure. It states the action but does not cover critical aspects like whether this is a read-only operation, potential rate limits, authentication needs, error handling, or the format of the returned schedule. This leaves significant gaps in understanding the tool's behavior.

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 a single, direct sentence that efficiently conveys the core purpose without any redundant information. It is appropriately sized and front-loaded, making it easy to understand at a glance.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It does not explain what the returned schedule includes (e.g., list of programs, timings) or any behavioral traits, which are essential for a tool with parameters and no structured output documentation. This leaves the agent with insufficient context for effective use.

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?

The input schema has 100% description coverage, with clear documentation for 'channel_id' and 'hours_ahead'. The description adds no additional parameter semantics beyond what the schema provides, such as examples of valid channel IDs or constraints on 'hours_ahead'. Thus, it meets the baseline for high schema coverage without adding extra value.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('upcoming schedule for a specific channel'), making the purpose unambiguous. However, it does not explicitly differentiate from sibling tools like 'get_now_playing' or 'search_programmes', which might also involve schedule-related queries, so it falls short of a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives such as 'get_now_playing' for current content or 'search_programmes' for broader searches. It lacks explicit when-to-use or when-not-to-use instructions, leaving usage context implied at best.

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/icyrainz/xmltv-mcp'

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