Skip to main content
Glama

pine_read64

Reads a 64-bit unsigned little-endian value from emulated memory, requiring 8-byte alignment. Returns result as string to maintain precision past 2^53.

Instructions

Read an unsigned 64-bit little-endian value from emulated memory. Address should be 8-byte aligned. Returned as a string to preserve precision past 2^53.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesMemory address (8-byte aligned)

Implementation Reference

  • Handler case for pine_read64: reads a 64-bit value from emulated memory via pine.read64(addr()), formats it with addrHex and fmtHex, and returns it as text.
    case "pine_read64": return ok(`${addrHex(addr())}: ${fmtHex(await pine.read64(addr()))}`);
  • Tool schema definition for pine_read64: name, description (64-bit LE read, 8-byte aligned, returned as string for precision), and inputSchema requiring an integer 'address' property.
    {
      name: "pine_read64",
      description: "Read an unsigned 64-bit little-endian value from emulated memory. Address should be 8-byte aligned. Returned as a string to preserve precision past 2^53.",
      inputSchema: {
        type: "object",
        required: ["address"],
        properties: { address: { type: "integer", description: "Memory address (8-byte aligned)" } },
      },
    },
  • src/tools.ts:171-249 (registration)
    The registerTools() function registers all tools (including pine_read64) via setRequestHandler on the MCP server using ListToolsRequestSchema and CallToolRequestSchema.
    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}`);
        }
      });
  • PineClient.read64() implementation: writes the address as a 32-bit LE buffer, sends Read64 opcode (0x03) over the PINE protocol, and reads the reply as a 64-bit unsigned little-endian bigint.
    async read64(addr: number): Promise<bigint> {
      const args = Buffer.alloc(4); args.writeUInt32LE(addr, 0);
      const r = await this.call(Op.Read64, args);
      return r.readBigUInt64LE(0);
    }
  • fmtHex helper: formats a number or bigint as 'decimal (0xHEX)'. Used by the pine_read64 handler to display the 64-bit value in both decimal and hex.
    function fmtHex(n: number | bigint): string {
      return `${n} (0x${n.toString(16).toUpperCase()})`;
    }
Behavior4/5

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

No annotations provided, so description carries full burden. Discloses endianness (little-endian), alignment (8-byte), and return type (string to preserve precision). Does not explicitly state read-only nature, but 'Read' strongly implies no side effects.

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?

Two sentences, zero wasted words. Every piece of information is necessary and presented efficiently.

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

Completeness4/5

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

For a simple read tool with one parameter and no output schema, description covers purpose, behavioral traits (alignment, endianness, return type), and parameter usage. Could mention error conditions (e.g., unaligned access) but otherwise complete.

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?

Only one parameter 'address' with aligned description. Schema description coverage is 100%, so baseline is 3. Description adds alignment requirement, already present in schema, no additional semantic depth.

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?

Description clearly states it reads an unsigned 64-bit little-endian value from emulated memory, specifies alignment (8-byte) and return format (string). Distinguishes from sibling tools (pine_read8, pine_read16, etc.) by bit width and endianness.

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

Usage Guidelines3/5

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

Implied usage for reading 64-bit values, but no explicit when-to-use or when-not-to-use guidance relative to siblings. Lacks differentiation criteria like performance or precision requirements.

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-pine'

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