create_category
Organize games in your Lutris library by creating custom categories to group and manage your collection effectively.
Instructions
Create a new game category
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Category name |
Implementation Reference
- src/tools/categories.ts:41-62 (handler)The tool handler implementation for "create_category" which accepts a name parameter, calls the DB helper, and formats the result.
server.tool( "create_category", "Create a new game category", { name: z.string().describe("Category name"), }, async (params) => { try { const category = createCategory(params.name); return { content: [ { type: "text", text: JSON.stringify({ message: "Category created", category }, null, 2), }, ], }; } catch (error) { return handleError(error); } } ); - src/db/queries.ts:154-160 (helper)The database query function that actually inserts the new category into the SQLite database.
export function createCategory(name: string): Category { const db = getDatabase(); const result = db .prepare("INSERT INTO categories (name) VALUES (?)") .run(name); return { id: result.lastInsertRowid as number, name }; }