Skip to main content
Glama

pine_write64

Write a 64-bit value in little-endian format to emulated RAM at an 8-byte aligned address. Accepts the value as a decimal string to preserve precision beyond 2^53.

Instructions

Write a 64-bit value (LE) to emulated RAM. Address must be 8-byte aligned. Pass the value as a decimal string to preserve precision past 2^53.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesMemory address (8-byte aligned)
valueYesDecimal string (e.g. "18446744073709551615")

Implementation Reference

  • The handler for pine_write64. Parses the value as BigInt from the string input, then calls pine.write64(), and returns a formatted confirmation string.
    case "pine_write64": {
      const v = BigInt(p.value as string);
      await pine.write64(addr(), v);
      return ok(`Wrote ${fmtHex(v)} → ${addrHex(addr())}`);
    }
  • The tool schema/definition for pine_write64. Describes writing a 64-bit LE value, requires address (integer) and value (decimal string pattern), with 8-byte alignment note.
    {
      name: "pine_write64",
      description: "Write a 64-bit value (LE) to emulated RAM. Address must be 8-byte aligned. Pass the value as a decimal string to preserve precision past 2^53.",
      inputSchema: {
        type: "object",
        required: ["address", "value"],
        properties: {
          address: { type: "integer", description: "Memory address (8-byte aligned)" },
          value:   { type: "string", pattern: "^[0-9]+$", description: "Decimal string (e.g. \"18446744073709551615\")" },
        },
      },
    },
  • The low-level write64 helper in PineClient. Allocates a 12-byte buffer (4 for addr + 8 for BigInt value), writes the address and BigUInt64LE value, then sends via the PINE protocol call with opcode Write64 (0x07).
    async write64(addr: number, val: bigint): Promise<void> {
      const args = Buffer.alloc(12);
      args.writeUInt32LE(addr, 0);
      args.writeBigUInt64LE(val, 4);
      await this.call(Op.Write64, args);
    }
  • The Write64 opcode constant (0x07) used in the PINE protocol.
    Write64:      0x07,
  • src/tools.ts:171-250 (registration)
    Registration of all tools including pine_write64 via server.setRequestHandler for both ListToolsRequestSchema and CallToolRequestSchema. The tool list (TOOLS array) and switch-case dispatch are both inside registerTools().
    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}`);
        }
      });
    }
Behavior3/5

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

No annotations exist, so the description covers the write operation, alignment requirement, and string format, but omits side effects, error behavior, or return value.

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 efficient sentences with no filler: first conveys purpose and alignment, second explains value format. Front-loaded and concise.

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?

Given low complexity (2 parameters, no output schema), the description covers essential aspects, though it could mention expected outcomes or error handling.

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

Parameters4/5

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

Schema coverage is 100% with parameter descriptions, and the description adds context about preserving precision past 2^53, complementing the schema.

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 clearly states the verb (write), resource (emulated RAM), and specifies the 64-bit width and little-endian byte order, distinguishing it from siblings like pine_write8.

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

Usage Guidelines4/5

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

The description implies usage for writing 64-bit values and provides alignment and precision guidance, but does not explicitly contrast with alternatives or mention when not to use.

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