Skip to main content
Glama

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
NameRequiredDescriptionDefault
game_idYesGame ID
category_nameYesCategory name

Implementation Reference

  • 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);
        }
      }
    );
  • 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;
    }

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