update_database
Modify RPG Maker MZ database entries including Actors, Classes, Skills, Items, Weapons, and Armors by updating specific fields and values.
Instructions
Update an entry in any database (Actors, Classes, Skills, Items, Weapons, Armors, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | Database name (e.g., 'Actors', 'Classes', 'Skills', 'Items') | |
| id | Yes | Entry ID | |
| project_path | Yes | Path to the RPG Maker MZ project directory | |
| updates | Yes | Object containing fields to update |
Implementation Reference
- src/game-creation-tools.ts:280-297 (handler)The core handler function that reads a specific RPG Maker MZ database JSON file (e.g., Actors.json), updates the entry at the given ID with the provided updates, and writes it back.export async function updateDatabase( projectPath: string, database: string, id: number, updates: any ) { const dbPath = path.join(projectPath, "data", `${database}.json`); const dbContent = await fs.readFile(dbPath, "utf-8"); const data = JSON.parse(dbContent); if (!data[id]) { throw new Error(`${database} entry ${id} not found`); } Object.assign(data[id], updates); await fs.writeFile(dbPath, JSON.stringify(data, null, 0), "utf-8"); return { success: true }; }
- src/index.ts:446-471 (schema)The input schema and tool specification for the 'update_database' tool, defining parameters: project_path, database, id, and updates.{ name: "update_database", description: "Update an entry in any database (Actors, Classes, Skills, Items, Weapons, Armors, etc.)", inputSchema: { type: "object", properties: { project_path: { type: "string", description: "Path to the RPG Maker MZ project directory", }, database: { type: "string", description: "Database name (e.g., 'Actors', 'Classes', 'Skills', 'Items')", }, id: { type: "number", description: "Entry ID", }, updates: { type: "object", description: "Object containing fields to update", }, }, required: ["project_path", "database", "id", "updates"], }, },
- src/index.ts:1246-1255 (registration)The registration and dispatch handler in the MCP server's CallToolRequestSchema that calls the updateDatabase function with parsed arguments and returns the result.case "update_database": { const projectPath = args.project_path as string; const database = args.database as string; const id = args.id as number; const updates = args.updates as any; const result = await updateDatabase(projectPath, database, id, updates); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }