Skip to main content
Glama
icyrainz

XMLTV MCP Server

by icyrainz

get_channels

Retrieve all available TV channels from XMLTV feeds to access programming data and schedule information.

Instructions

Get list of all available TV channels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get_channels' tool. Fetches cached XMLTV data and maps channels to an array of {id, name, icon} objects.
    async function getChannels() {
      const data = await getXmltvData();
      return data.tv.channel.map(ch => ({
        id: ch.id,
        name: ch["display-name"],
        icon: typeof ch.icon === 'object' ? ch.icon.src : undefined,
      }));
    }
  • The tool schema definition including name, description, and empty input schema (no parameters required).
    {
      name: "get_channels",
      description: "Get list of all available TV channels",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:339-349 (registration)
    Registration in the CallToolRequestSchema handler: switch case that invokes getChannels() and formats response as JSON text.
    case "get_channels": {
      const channels = await getChannels();
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(channels, null, 2),
          },
        ],
      };
    }
  • src/index.ts:332-334 (registration)
    Handler for ListToolsRequestSchema that returns the tools list including 'get_channels'.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return { tools };
    });
  • Helper function to fetch, parse, and cache XMLTV data from the configured URL, used by getChannels.
    async function getXmltvData(): Promise<XmltvData> {
      const now = Date.now();
    
      if (cache && (now - cache.timestamp) < CACHE_TTL) {
        return cache.data;
      }
    
      const response = await fetch(XMLTV_URL);
      if (!response.ok) {
        throw new Error(`Failed to fetch XMLTV: ${response.statusText}`);
      }
    
      const xmlText = await response.text();
      const parser = new XMLParser({
        ignoreAttributes: false,
        attributeNamePrefix: "",
      });
    
      const parsed = parser.parse(xmlText) as XmltvData;
    
      // Ensure arrays are always arrays (parser might return single object)
      if (parsed.tv.channel && !Array.isArray(parsed.tv.channel)) {
        parsed.tv.channel = [parsed.tv.channel];
      }
      if (parsed.tv.programme && !Array.isArray(parsed.tv.programme)) {
        parsed.tv.programme = [parsed.tv.programme];
      }
    
      cache = { data: parsed, timestamp: now };
      return parsed;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a read operation ('Get list'), but doesn't mention whether it returns live data, cached data, pagination, rate limits, authentication requirements, or error conditions. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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, efficient sentence that communicates the core purpose without any wasted words. It's appropriately sized for a simple retrieval tool and front-loads the essential information.

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

Completeness3/5

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

For a simple read-only tool with no parameters and no output schema, the description covers the basic purpose adequately. However, without annotations or output schema, it should ideally mention what format the channel list returns (e.g., array of objects with IDs/names) and any behavioral constraints. The lack of output schema increases the need for return value description.

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?

The tool has zero parameters (schema coverage 100%), so the description doesn't need to explain any inputs. The baseline for zero parameters is 4, as there are no parameters requiring semantic explanation beyond what the empty schema already indicates.

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 ('list of all available TV channels'), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'get_schedule' or 'search_programmes', but the focus on channels rather than programmes or schedules provides implicit differentiation.

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 like 'get_schedule' (which might return channel schedules) or 'search_programmes' (which might filter by content). There's no mention of prerequisites, context, or comparison with sibling 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/icyrainz/xmltv-mcp'

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