Skip to main content
Glama
icyrainz

XMLTV MCP Server

by icyrainz

search_programmes

Find TV programmes by searching titles, subtitles, or descriptions within XMLTV data feeds to locate specific shows and schedule information.

Instructions

Search programmes by title, subtitle, or description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • The handler function that implements the search_programmes tool logic: fetches cached XMLTV data, filters programmes matching the query in title/subtitle/desc, enriches with channel info, limits to 50 results.
    async function searchProgrammes(query: string) { const data = await getXmltvData(); const lowerQuery = query.toLowerCase(); const results = data.tv.programme .filter(prog => { const title = prog.title?.toLowerCase() || ""; const subtitle = prog["sub-title"]?.toLowerCase() || ""; const desc = prog.desc?.toLowerCase() || ""; return title.includes(lowerQuery) || subtitle.includes(lowerQuery) || desc.includes(lowerQuery); }) .map(prog => { const channel = data.tv.channel.find(ch => ch.id === prog.channel); return { channel: { id: prog.channel, name: channel?.["display-name"] || prog.channel, }, 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"], }; }) .slice(0, 50); // Limit to 50 results return results; }
  • JSON Schema defining the input for search_programmes tool: requires a 'query' string.
    inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query", }, }, required: ["query"], },
  • src/index.ts:298-311 (registration)
    Registration of the search_programmes tool in the tools array, advertised via ListToolsRequestSchema.
    { name: "search_programmes", description: "Search programmes by title, subtitle, or description", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query", }, }, required: ["query"], }, },
  • src/index.ts:379-390 (registration)
    Dispatch handler in CallToolRequestSchema switch that extracts query arg, calls searchProgrammes, and returns JSON results.
    case "search_programmes": { const { query } = request.params.arguments as { query: string }; const results = await searchProgrammes(query); return { content: [ { type: "text", text: JSON.stringify(results, 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