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),
          },
        ],
      };
    }
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 what the tool does but doesn't describe how it behaves: no information about pagination, rate limits, authentication requirements, error conditions, or what happens when no results are found. For a search tool with zero annotation coverage, this leaves significant gaps in understanding operational 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, efficient sentence that communicates the core functionality without unnecessary words. It's appropriately sized for a simple search tool and front-loads the essential information. Every word earns its place in this concise statement.

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?

For a search tool with no annotations and no output schema, the description is insufficient. It doesn't explain what format results are returned in, whether there are limitations on search scope, or how results are ordered. Given the lack of structured metadata, the description should provide more operational context to be complete.

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?

Schema description coverage is 100% with the single 'query' parameter well-documented in the schema. The description adds minimal value by mentioning what fields are searched (title, subtitle, description), which provides context about how the query parameter is used. This meets the baseline for high schema coverage but doesn't significantly enhance parameter understanding beyond the schema.

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 action ('search') and target resource ('programmes'), specifying the searchable fields (title, subtitle, description). It distinguishes from siblings like 'get_channels' or 'get_schedule' by focusing on search functionality rather than retrieval of specific data sets. However, it doesn't explicitly differentiate from potential similar search tools that might exist.

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_programme_details' or 'get_now_playing'. It doesn't mention prerequisites, limitations, or typical use cases. The agent must infer usage from the tool name and description alone.

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