pine_save_state
Save the current emulator state to a numbered slot for later restoration.
Instructions
Trigger the emulator to save its current state to a numbered slot.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slot | Yes | Save state slot (0-255) |
Implementation Reference
- src/tools.ts:237-240 (handler)The tool handler for 'pine_save_state' — the actual MCP request handler that calls pine.saveState(slot) and returns a confirmation message.
case "pine_save_state": { await pine.saveState(p.slot as number); return ok(`Save state triggered for slot ${p.slot}`); } - src/tools.ts:136-145 (schema)The tool schema/definition registration for 'pine_save_state', including description and inputSchema requiring a 'slot' integer (0-255).
name: "pine_save_state", description: "Trigger the emulator to save its current state to a numbered slot.", inputSchema: { type: "object", required: ["slot"], properties: { slot: { type: "integer", minimum: 0, maximum: 255, description: "Save state slot (0-255)" }, }, }, }, - src/tools.ts:171-172 (registration)The registerTools function that registers all tools (including pine_save_state) via ListToolsRequestSchema and handles tool calls via CallToolRequestSchema.
export function registerTools(server: Server, pine: PineClient): void { server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS })); - src/pine.ts:274-277 (helper)The PineClient.saveState() helper method that encodes the slot number into a 1-byte buffer and sends it with the SaveState opcode (0x09) via the PINE protocol.
async saveState(slot: number): Promise<void> { const args = Buffer.alloc(1); args.writeUInt8(slot, 0); await this.call(Op.SaveState, args); } - src/pine.ts:35-42 (helper)The SaveState opcode constant (0x09) defined in the Op enum of the PINE protocol client.
SaveState: 0x09, LoadState: 0x0A, Title: 0x0B, ID: 0x0C, UUID: 0x0D, GameVersion: 0x0E, Status: 0x0F, } as const;