pine_get_info
Get the loaded game's title, serial, disc CRC, game version, and emulator status from a PINE-compatible emulator.
Instructions
Get the loaded game's title, serial (e.g. SLUS-21274), disc CRC, game version, and emulator status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:27-30 (schema)Tool definition / inputSchema for 'pine_get_info' — declares name, description, and an empty input schema (no parameters).
name: "pine_get_info", description: "Get the loaded game's title, serial (e.g. SLUS-21274), disc CRC, game version, and emulator status.", inputSchema: { type: "object", properties: {} }, }, - src/tools.ts:185-200 (handler)Handler case for 'pine_get_info' — calls pine.getTitle(), pine.getId(), pine.getUuid(), pine.getGameVersion(), and pine.getStatus() in parallel, then formats the results into a text response.
case "pine_get_info": { const [title, id, uuid, gameVer, status] = await Promise.all([ pine.getTitle().catch(() => "(unavailable)"), pine.getId().catch(() => "(unavailable)"), pine.getUuid().catch(() => "(unavailable)"), pine.getGameVersion().catch(() => "(unavailable)"), pine.getStatus(), ]); return ok( `Title: ${title}\n` + `Serial: ${id}\n` + `Disc CRC: ${uuid}\n` + `Game version: ${gameVer}\n` + `Status: ${status}`, ); } - src/tools.ts:171-249 (registration)Registration via registerTools() — sets up the CallToolRequestSchema handler that dispatches via switch/case to the 'pine_get_info' handler.
export function registerTools(server: Server, pine: PineClient): void { server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS })); server.setRequestHandler(CallToolRequestSchema, async (req) => { const { name, arguments: args = {} } = req.params; const p = args as Record<string, unknown>; const addr = () => p.address as number; switch (name) { case "pine_ping": { const v = await pine.getVersion(); return ok(`OK — emulator: ${v}`); } case "pine_get_info": { const [title, id, uuid, gameVer, status] = await Promise.all([ pine.getTitle().catch(() => "(unavailable)"), pine.getId().catch(() => "(unavailable)"), pine.getUuid().catch(() => "(unavailable)"), pine.getGameVersion().catch(() => "(unavailable)"), pine.getStatus(), ]); return ok( `Title: ${title}\n` + `Serial: ${id}\n` + `Disc CRC: ${uuid}\n` + `Game version: ${gameVer}\n` + `Status: ${status}`, ); } case "pine_get_status": { return ok(`Status: ${await pine.getStatus()}`); } case "pine_read8": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read8(addr()))}`); case "pine_read16": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read16(addr()))}`); case "pine_read32": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read32(addr()))}`); case "pine_read64": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read64(addr()))}`); case "pine_write8": { await pine.write8(addr(), p.value as number); return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(addr())}`); } case "pine_write16": { await pine.write16(addr(), p.value as number); return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(addr())}`); } case "pine_write32": { await pine.write32(addr(), p.value as number); return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(addr())}`); } case "pine_write64": { const v = BigInt(p.value as string); await pine.write64(addr(), v); return ok(`Wrote ${fmtHex(v)} → ${addrHex(addr())}`); } case "pine_read_range": { const bytes = await pine.readRange(p.address as number, p.length as number); const hex = Array.from(bytes) .map((b) => b.toString(16).padStart(2, "0").toUpperCase()) .join(" "); return ok(`${addrHex(p.address as number)} [${bytes.length} bytes]:\n${hex}`); } case "pine_save_state": { await pine.saveState(p.slot as number); return ok(`Save state triggered for slot ${p.slot}`); } case "pine_load_state": { await pine.loadState(p.slot as number); return ok(`Load state triggered for slot ${p.slot}`); } default: throw new Error(`Unknown tool: ${name}`); } }); - src/pine.ts:268-272 (helper)Helper methods on PineClient used by the handler: getTitle(), getId(), getUuid(), getGameVersion() — each reads a string via the PINE protocol.
async getVersion(): Promise<string> { return this.readString(Op.Version); } async getTitle(): Promise<string> { return this.readString(Op.Title); } async getId(): Promise<string> { return this.readString(Op.ID); } async getUuid(): Promise<string> { return this.readString(Op.UUID); } async getGameVersion(): Promise<string> { return this.readString(Op.GameVersion); } - src/pine.ts:283-287 (helper)Helper method getStatus() on PineClient — reads emulator status via PINE protocol and maps numeric codes to strings.
async getStatus(): Promise<EmuStatus> { const r = await this.call(Op.Status); const s = r.readUInt32LE(0); return s === 0 ? "running" : s === 1 ? "paused" : s === 2 ? "shutdown" : "unknown"; }