Skip to main content
Glama
icyrainz

XMLTV MCP Server

by icyrainz

get_now_playing

Retrieve currently airing TV programmes across all channels from XMLTV feeds to monitor live broadcasts and check what's on now.

Instructions

Get currently playing programmes on all channels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The getNowPlaying function implements the core logic to retrieve currently playing programmes across all channels by parsing XMLTV data and checking the current time against programme start and stop times.
    async function getNowPlaying() { const data = await getXmltvData(); const now = new Date(); const nowPlaying = data.tv.channel.map(channel => { const currentProgramme = data.tv.programme.find(prog => { if (prog.channel !== channel.id) return false; const start = parseXmltvDate(prog.start); const stop = parseXmltvDate(prog.stop); return now >= start && now < stop; }); return { channel: { id: channel.id, name: channel["display-name"], }, programme: currentProgramme ? { title: currentProgramme.title, subtitle: currentProgramme["sub-title"], description: currentProgramme.desc, start: currentProgramme.start, stop: currentProgramme.stop, episodeNum: Array.isArray(currentProgramme["episode-num"]) ? currentProgramme["episode-num"][0] : currentProgramme["episode-num"], } : null, }; }); return nowPlaying; }
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    { name: "get_now_playing", description: "Get currently playing programmes on all channels", inputSchema: { type: "object", properties: {}, }, },
  • src/index.ts:351-361 (registration)
    MCP server request handler switch case that registers and invokes the get_now_playing tool by calling the getNowPlaying function and returning JSON-formatted results.
    case "get_now_playing": { const nowPlaying = await getNowPlaying(); return { content: [ { type: "text", text: JSON.stringify(nowPlaying, null, 2), }, ], }; }

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