Skip to main content
Glama

list_games

Browse and filter games in your Lutris library using criteria like runner, platform, installed status, or search terms, with pagination for large collections.

Instructions

List and filter games in the Lutris library with pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
runnerNoFilter by runner (e.g. steam, wine, linux)
platformNoFilter by platform
installedNoFilter by installed status
categoryNoFilter by category name
searchNoSearch by name or slug
serviceNoFilter by service (e.g. steam)
limitNoResults per page
offsetNoOffset for pagination
sort_byNoSort columnname
sort_orderNoSort directionasc

Implementation Reference

  • The MCP tool handler for 'list_games', which calls the database function `listGames` and returns the formatted results.
    async (params) => {
      try {
        const result = listGames(params);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { total: result.total, count: result.games.length, games: result.games },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        return handleError(error);
      }
    }
  • Registration of the 'list_games' tool in the MCP server, including input schema validation via Zod.
    export function registerGameTools(server: McpServer) {
      server.tool(
        "list_games",
        "List and filter games in the Lutris library with pagination",
        {
          runner: z.string().optional().describe("Filter by runner (e.g. steam, wine, linux)"),
          platform: z.string().optional().describe("Filter by platform"),
          installed: z.boolean().optional().describe("Filter by installed status"),
          category: z.string().optional().describe("Filter by category name"),
          search: z.string().optional().describe("Search by name or slug"),
          service: z.string().optional().describe("Filter by service (e.g. steam)"),
          limit: z.coerce.number().min(1).max(200).default(50).describe("Results per page"),
          offset: z.coerce.number().min(0).default(0).describe("Offset for pagination"),
          sort_by: z
            .enum(["name", "sortname", "playtime", "lastplayed", "installed_at", "year", "updated"])
            .default("name")
            .describe("Sort column"),
          sort_order: z.enum(["asc", "desc"]).default("asc").describe("Sort direction"),
        },
  • The database query implementation of `listGames` that executes the SQL to retrieve and filter game records.
    export function listGames(opts: ListGamesOptions): { games: Game[]; total: number } {
      const db = getDatabase();
      const conditions: string[] = [];
      const params: Record<string, unknown> = {};
    
      if (opts.runner) {
        conditions.push("g.runner = :runner");
        params.runner = opts.runner;
      }
      if (opts.platform) {
        conditions.push("g.platform = :platform");
        params.platform = opts.platform;
      }
      if (opts.installed !== undefined) {
        conditions.push("g.installed = :installed");
        params.installed = opts.installed ? 1 : 0;
      }
      if (opts.service) {
        conditions.push("g.service = :service");
        params.service = opts.service;
      }
      if (opts.search) {
        conditions.push("(g.name LIKE :search OR g.slug LIKE :search)");
        params.search = `%${opts.search}%`;
      }
    
      let joins = "";
      if (opts.category) {
        joins =
          "JOIN games_categories gc ON gc.game_id = g.id JOIN categories c ON c.id = gc.category_id";
        conditions.push("c.name = :category");
        params.category = opts.category;
      }
    
      const where = conditions.length ? `WHERE ${conditions.join(" AND ")}` : "";
      const sortCol = ALLOWED_SORT_COLUMNS.has(opts.sort_by) ? opts.sort_by : "name";
      const sortDir = opts.sort_order === "desc" ? "DESC" : "ASC";
    
      const countRow = db
        .prepare(`SELECT COUNT(DISTINCT g.id) as count FROM games g ${joins} ${where}`)
        .get(params) as { count: number };
    
      const games = db
        .prepare(
          `SELECT DISTINCT g.* FROM games g ${joins} ${where} ORDER BY g.${sortCol} ${sortDir} LIMIT :limit OFFSET :offset`
        )
        .all({ ...params, limit: opts.limit, offset: opts.offset }) as Game[];
    
      return { games, total: countRow.count };
    }
  • The `ListGamesOptions` interface defining the input parameters accepted by the database query.
    export interface ListGamesOptions {
      runner?: string;
      platform?: string;
      installed?: boolean;
      category?: string;
      search?: string;
      service?: string;
      limit: number;
      offset: number;
      sort_by: string;
      sort_order: "asc" | "desc";
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'with pagination', which hints at output structure, but lacks details on rate limits, authentication needs, error handling, or what the response looks like (e.g., format, fields). This is inadequate for a tool with 10 parameters and no output schema.

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 front-loads the core functionality ('List and filter games') and includes key scope ('with pagination'). There is no wasted verbiage, making it highly concise and well-structured.

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 complexity (10 parameters, no output schema, and no annotations), the description is insufficient. It doesn't explain return values, error conditions, or behavioral nuances like pagination mechanics. For a list/filter tool with many options, more context is needed to guide 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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds minimal value by implying filtering capabilities but doesn't provide additional context beyond what the schema offers, such as examples or usage tips for parameters like 'runner' or 'service'.

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 ('List and filter') and resource ('games in the Lutris library'), with the addition of 'with pagination' providing scope. However, it doesn't explicitly differentiate from sibling tools like 'search_service_games' or 'get_game', which could offer overlapping functionality.

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 'search_service_games' or 'get_game', nor does it mention prerequisites or context for filtering. Usage is implied through the mention of filtering and pagination, but explicit comparisons are absent.

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/Praeses0/lutris-mcp'

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