update_item
Modify properties of an item in your RPG Maker MZ/MV project. Specify the item ID and the changes to apply.
Instructions
Update an item's properties
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| itemId | Yes | ||
| updates | Yes |
Implementation Reference
- src/tools/itemTools.ts:47-65 (handler)The handler function `updateItem` that performs the logic of reading the item list, updating the specified item, and writing the changes back to Items.json.
export async function updateItem( projectPath: string, itemId: number, updates: Partial<Item> ): Promise<Item> { const items = await getItems(projectPath); const itemIndex = items.findIndex(item => item && item.id === itemId); if (itemIndex === -1) { throw new Error(`Item with ID ${itemId} not found`); } items[itemIndex] = { ...items[itemIndex], ...updates }; const itemsPath = getDataPath(projectPath, 'Items.json'); await writeJsonFile(itemsPath, items); return items[itemIndex]; } - src/index.ts:341-351 (registration)Registration of the `update_item` tool definition in the MCP server.
name: 'update_item', description: 'Update an item\'s properties', inputSchema: { type: 'object', properties: { itemId: { type: 'number' }, updates: { type: 'object' }, }, required: ['itemId', 'updates'], }, }, - src/index.ts:678-679 (handler)The switch case in `executeToolFunction` that delegates the `update_item` tool call to `itemTools.updateItem`.
case 'update_item': return await itemTools.updateItem(this.projectPath, args.itemId, args.updates);