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
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Search by name or app ID | |
| service | No | Service to search (e.g. steam) | steam |
| limit | No | Results per page | |
| offset | No | Offset for pagination |
Implementation Reference
- src/tools/service-games.ts:15-34 (handler)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 }; } } - src/tools/service-games.ts:6-14 (registration)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"), }, - src/db/queries.ts:195-220 (handler)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 }; } - src/db/queries.ts:188-193 (schema)The input schema/interface for the "search_service_games" query.
export interface SearchServiceGamesOptions { query?: string; service: string; limit: number; offset: number; }