Skip to main content
Glama

bizhawk_read8

Read an unsigned 8-bit byte from emulator memory at a given address. Useful for reading status flags, counters, and 8-bit fields.

Instructions

PURPOSE: Read an unsigned 8-bit byte from emulator memory at the given address. USAGE: Use for single-byte status flags, counters, and 8-bit fields. For 16- or 32-bit values use bizhawk_read16/read32 (one call instead of multi-byte assembly); for spans of more than ~4 bytes use bizhawk_read_range (one round-trip instead of N frame-latency hops). BEHAVIOR: No side effects — pure read. Reads work the same way whether emulation is paused or running. Returns an error if the named domain doesn't exist, the address is out of range for the domain, or the loaded core doesn't expose memory.read_u8. RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)', e.g. '0x09C6: 99 (0x63)'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesByte offset within the chosen memory domain. Per-domain offsets are 0-based and INDEPENDENT of system bus addresses (e.g. SNES WRAM uses 0x09C6, NOT 0x7E09C6). Reads 1 consecutive byte starting here. Returns an error if address < 0 or address + 1 exceeds the domain's size.
domainNoOptional case-sensitive memory domain name. Omit to use BizHawk's currently selected domain (see bizhawk_get_info → current_memory_domain). Discover available names with bizhawk_list_memory_domains; they vary per system (WRAM on SNES, RAM on NES, RDRAM on N64, 68K RAM on Genesis, MainRAM on PSX, EWRAM/IWRAM on GBA). Returns an error if the name doesn't match any domain on the loaded core.

Implementation Reference

  • Tool definition and input schema for bizhawk_read8, describing the 8-bit read tool, its purpose, usage guidance, behavior (no side effects), return format, and input schema requiring 'address' (integer) with optional 'domain' (string).
    {
      name: "bizhawk_read8",
      description:
        "PURPOSE: Read an unsigned 8-bit byte from emulator memory at the given address. " +
        "USAGE: Use for single-byte status flags, counters, and 8-bit fields. For 16- or 32-bit values use bizhawk_read16/read32 (one call instead of multi-byte assembly); for spans of more than ~4 bytes use bizhawk_read_range (one round-trip instead of N frame-latency hops). " +
        "BEHAVIOR: No side effects — pure read. Reads work the same way whether emulation is paused or running. Returns an error if the named domain doesn't exist, the address is out of range for the domain, or the loaded core doesn't expose memory.read_u8. " +
        "RETURNS: Single line 'ADDR_HEX: VAL_DEC (0xVAL_HEX)', e.g. '0x09C6: 99 (0x63)'.",
      inputSchema: {
        type: "object",
        required: ["address"],
        properties: {
          address: { type: "integer", minimum: 0, description: ADDRESS_PARAM_DESC(1) },
          domain:  { type: "string", description: DOMAIN_PARAM_DESC },
        },
        additionalProperties: false,
      },
    },
  • Handler for bizhawk_read8: calls bh.call('read8', { address, domain }) and formats the result as 'ADDR_HEX: VAL_DEC (0xVAL_HEX)'. This is the case in the CallToolRequestSchema switch statement that executes the tool logic.
    case "bizhawk_read8":  return ok(`${addrHex(a())}: ${fmtHex(await bh.call<number>("read8", { address: a(), ...dom() }))}`);
  • src/tools.ts:486-488 (registration)
    Tool registration: TOOLS array (containing all tool definitions including bizhawk_read8) is registered via ListToolsRequestSchema handler, and the CallToolRequestSchema handler dispatches tool names (including 'bizhawk_read8') to their implementations.
    export function registerTools(server: Server, bh: BizhawkServer): void {
      server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
  • BizhawkServer.call() method: generic RPC method that enqueues commands to send to BizHawk's Lua bridge over TCP. Used by the handler to invoke 'read8' on the BizHawk side.
    async call<T = unknown>(method: string, params: Record<string, unknown> = {}): Promise<T> {
      return new Promise<T>((resolve, reject) => {
        const id = this.nextId++;
        const pending: PendingCmd = {
          id,
          method,
          params,
          resolve: (r) => resolve(r as T),
          reject,
        };
    
        const timer = setTimeout(() => {
          // Drop from queue if still waiting; from inflight if already sent.
          this.queue   = this.queue.filter((p) => p.id !== id);
          this.inflight.delete(id);
          if (this.inflight.size === 0) this.awaitingResult = false;
          reject(new Error(
            `BizHawk call "${method}" timed out (${this.timeoutMs}ms) — ` +
            `is the bridge.lua script still polling?`,
          ));
        }, this.timeoutMs);
    
        // Wrap so the timer always clears
        const origResolve = pending.resolve, origReject = pending.reject;
        pending.resolve = (r) => { clearTimeout(timer); origResolve(r); };
        pending.reject  = (e) => { clearTimeout(timer); origReject(e); };
    
        this.queue.push(pending);
      });
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description fully covers behavior: 'No side effects — pure read. Reads work the same way whether emulation is paused or running.' It also lists error conditions for missing domain, out-of-range address, or missing core functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with labeled sections (PURPOSE, USAGE, BEHAVIOR, RETURNS) and every sentence adds value. It is concise without being terse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description includes a RETURNS section with an example format and explains error conditions. It is complete for a simple read tool, covering all necessary context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and the description does not add new information beyond the schema's thorough parameter descriptions. Baseline 3 is appropriate as it doesn't compensate further.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with 'PURPOSE: Read an unsigned 8-bit byte from emulator memory at the given address.' This is a specific verb and resource, clearly distinguishing from sibling tools like bizhawk_read16, bizhawk_read32, and bizhawk_read_range.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The USAGE section explicitly states 'Use for single-byte status flags, counters, and 8-bit fields' and advises using bizhawk_read16/read32 for larger values or bizhawk_read_range for spans, providing clear when-to-use and when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dmang-dev/mcp-bizhawk'

If you have feedback or need assistance with the MCP directory API, please join our Discord server