unassign_category
Remove a game from a category in your Lutris gaming library to reorganize your collection and maintain organized categories.
Instructions
Remove a game from a category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| game_id | Yes | Game ID | |
| category_name | Yes | Category name |
Implementation Reference
- src/tools/categories.ts:105-148 (handler)The handler function that implements the logic for the "unassign_category" tool.
server.tool( "unassign_category", "Remove a game from a category", { game_id: z.coerce.number().describe("Game ID"), category_name: z.string().describe("Category name"), }, async (params) => { try { const category = getCategoryByName(params.category_name); if (!category) { return { content: [{ type: "text", text: `Category "${params.category_name}" not found.` }], isError: true, }; } const removed = unassignCategory(params.game_id, category.id); if (!removed) { return { content: [ { type: "text", text: "Game was not in that category." }, ], isError: true, }; } return { content: [ { type: "text", text: JSON.stringify( { message: `Game removed from "${category.name}".` }, null, 2 ), }, ], }; } catch (error) { return handleError(error); } } ); - src/db/queries.ts:176-184 (helper)Database helper function that executes the removal of a game from a category.
export function unassignCategory(gameId: number, categoryId: number): boolean { const db = getDatabase(); const result = db .prepare( "DELETE FROM games_categories WHERE game_id = ? AND category_id = ?" ) .run(gameId, categoryId); return result.changes > 0; }