Skip to main content
Glama

search_service_games

Search for games across external platforms like Steam and GOG that are synced with Lutris gaming library.

Instructions

Search games from external services (Steam, GOG, etc.) synced in Lutris

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSearch by name or app ID
serviceNoService to search (e.g. steam)steam
limitNoResults per page
offsetNoOffset for pagination

Implementation Reference

  • The MCP tool handler for "search_service_games" which parses inputs and executes the database query.
    async (params) => {
      try {
        const result = searchServiceGames(params);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                { total: result.total, count: result.games.length, games: result.games },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        const msg = error instanceof Error ? error.message : String(error);
        return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
      }
    }
  • Tool registration for "search_service_games" in the MCP server.
    server.tool(
      "search_service_games",
      "Search games from external services (Steam, GOG, etc.) synced in Lutris",
      {
        query: z.string().optional().describe("Search by name or app ID"),
        service: z.string().default("steam").describe("Service to search (e.g. steam)"),
        limit: z.coerce.number().min(1).max(100).default(25).describe("Results per page"),
        offset: z.coerce.number().min(0).default(0).describe("Offset for pagination"),
      },
  • The actual database query implementation for "search_service_games".
    export function searchServiceGames(
      opts: SearchServiceGamesOptions
    ): { games: ServiceGame[]; total: number } {
      const db = getDatabase();
      const conditions: string[] = ["service = :service"];
      const params: Record<string, unknown> = { service: opts.service };
    
      if (opts.query) {
        conditions.push("(name LIKE :query OR appid LIKE :query)");
        params.query = `%${opts.query}%`;
      }
    
      const where = `WHERE ${conditions.join(" AND ")}`;
    
      const countRow = db
        .prepare(`SELECT COUNT(*) as count FROM service_games ${where}`)
        .get(params) as { count: number };
    
      const games = db
        .prepare(
          `SELECT * FROM service_games ${where} ORDER BY name ASC LIMIT :limit OFFSET :offset`
        )
        .all({ ...params, limit: opts.limit, offset: opts.offset }) as ServiceGame[];
    
      return { games, total: countRow.count };
    }
  • The input schema/interface for the "search_service_games" query.
    export interface SearchServiceGamesOptions {
      query?: string;
      service: string;
      limit: number;
      offset: number;
    }

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