Skip to main content
Glama
dmang-dev

mcp-dolphin

dolphin_press_wiimote_buttons

Set Wii Remote button inputs for one frame on a specified port. Supports A, B, One, Two, Plus, Minus, Home, D-pad directions. State is destructive: omitted buttons are released.

Instructions

PURPOSE: Set Wii Remote button state on a given port for one frame's worth of input. USAGE: Buttons supported: A, B, One, Two, Plus, Minus, Home, Up, Down, Left, Right. v0.1.0 covers the basic Wii Remote button surface only — pointer position, accelerometer, swing/shake/tilt, and Nunchuk/Classic Controller attachments are not yet wired (deferred to a future release). For now, games requiring motion or pointer input have limited agent control. BEHAVIOR: DESTRUCTIVE to Wii Remote state for the addressed port. Anything you don't include is released. RETURNS: 'Set Wii Remote port N: '.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNoWii Remote port (0-3, defaults to 0 for Remote 1).
stateYesButton state object. Boolean keys for each button: A, B, One, Two, Plus, Minus, Home, Up, Down, Left, Right. Omit a key to leave it released (false).

Implementation Reference

  • The handler for the 'dolphin_press_wiimote_buttons' tool. It extracts the port (default 0) and state from arguments, calls the bridge method 'controller.set_wiimote_buttons', and returns a summary of which buttons were set.
    case "dolphin_press_wiimote_buttons": {
      const port = (p.port as number | undefined) ?? 0;
      const state = p.state as Record<string, unknown>;
      await dol.call("controller.set_wiimote_buttons", [port, state]);
      const keys = Object.keys(state).join(",") || "(empty)";
      return ok(`Set Wii Remote port ${port}: ${keys}`);
    }
  • The tool definition and inputSchema for 'dolphin_press_wiimote_buttons'. It defines the name, description, and JSON Schema for the 'port' (integer 0-3) and 'state' (object with boolean keys for A, B, One, Two, Plus, Minus, Home, Up, Down, Left, Right) parameters.
    {
      name: "dolphin_press_wiimote_buttons",
      description:
        "PURPOSE: Set Wii Remote button state on a given port for one frame's worth of input. " +
        `USAGE: Buttons supported: ${WIIMOTE_BUTTON_NAMES}. v0.1.0 covers the basic Wii Remote button surface only — pointer position, accelerometer, swing/shake/tilt, and Nunchuk/Classic Controller attachments are not yet wired (deferred to a future release). For now, games requiring motion or pointer input have limited agent control. ` +
        "BEHAVIOR: DESTRUCTIVE to Wii Remote state for the addressed port. Anything you don't include is released. " +
        "RETURNS: 'Set Wii Remote port N: <state-summary>'.",
      inputSchema: {
        type: "object",
        required: ["state"],
        properties: {
          port: {
            type: "integer",
            minimum: 0,
            maximum: 3,
            description: "Wii Remote port (0-3, defaults to 0 for Remote 1).",
          },
          state: {
            type: "object",
            additionalProperties: true,
            description:
              "Button state object. Boolean keys for each button: A, B, One, Two, Plus, Minus, Home, Up, Down, Left, Right. " +
              "Omit a key to leave it released (false).",
          },
        },
        additionalProperties: false,
      },
  • src/tools.ts:488-618 (registration)
    The registerTools function that sets up ListToolsRequestSchema and CallToolRequestSchema handlers. The tool is registered in the TOOLS array (line 305) and dispatched via a switch/case statement (line 554) inside the CallToolRequestSchema handler.
    export function registerTools(server: Server, dol: DolphinClient): 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 a = () => p.address as number;
    
        switch (name) {
          case "dolphin_ping": {
            const r = await dol.call<{ bridge_version: string; dolphin: string }>("bridge.ping");
            return ok(`OK — bridge v${r.bridge_version} (${r.dolphin})`);
          }
          case "dolphin_get_info": {
            const r = await dol.call<{ bridge_version: string; dolphin: string }>("bridge.ping");
            return ok(
              `Bridge version: ${r.bridge_version}\n` +
              `Dolphin label:  ${r.dolphin}`,
            );
          }
    
          case "dolphin_read8":  return ok(`${addrHex(a())}: ${fmtHex(await dol.call<number>("memory.read_u8",  [a()]))}`);
          case "dolphin_read16": return ok(`${addrHex(a())}: ${fmtHex(await dol.call<number>("memory.read_u16", [a()]))}`);
          case "dolphin_read32": return ok(`${addrHex(a())}: ${fmtHex(await dol.call<number>("memory.read_u32", [a()]))}`);
          case "dolphin_read64": {
            const v = BigInt(await dol.call<number | string>("memory.read_u64", [a()]) as never);
            return ok(`${addrHex(a())}: ${fmtHex(v)}`);
          }
    
          case "dolphin_read_range": {
            const len = p.length as number;
            const hex = await dol.call<string>("memory.read_bytes", [a(), len]);
            const bytes = hex.match(/.{2}/g) ?? [];
            const spaced = bytes.map((b) => b.toUpperCase()).join(" ");
            return ok(`${addrHex(a())} [${bytes.length} bytes]:\n${spaced}`);
          }
    
          case "dolphin_write8": {
            await dol.call("memory.write_u8", [a(), p.value as number]);
            return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(a())}`);
          }
          case "dolphin_write16": {
            await dol.call("memory.write_u16", [a(), p.value as number]);
            return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(a())}`);
          }
          case "dolphin_write32": {
            await dol.call("memory.write_u32", [a(), p.value as number]);
            return ok(`Wrote ${fmtHex(p.value as number)} → ${addrHex(a())}`);
          }
          case "dolphin_write64": {
            const v = BigInt(p.value as string);
            // Felk's API takes a Python int; JS BigInt won't JSON-serialise so we
            // convert to a string and the bridge parses it back via int(str).
            // (For now the bridge actually accepts a JSON number — but 2^53 boundary
            // hits hard, so we use string transport and let the bridge widen.)
            await dol.call("memory.write_u64", [a(), v <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(v) : Number(v)]);
            return ok(`Wrote ${fmtHex(v)} → ${addrHex(a())}`);
          }
    
          case "dolphin_press_gc_buttons": {
            const port = (p.port as number | undefined) ?? 0;
            const state = p.state as Record<string, unknown>;
            await dol.call("controller.set_gc_buttons", [port, state]);
            const keys = Object.keys(state).join(",") || "(empty)";
            return ok(`Set GC port ${port}: ${keys}`);
          }
          case "dolphin_press_wiimote_buttons": {
            const port = (p.port as number | undefined) ?? 0;
            const state = p.state as Record<string, unknown>;
            await dol.call("controller.set_wiimote_buttons", [port, state]);
            const keys = Object.keys(state).join(",") || "(empty)";
            return ok(`Set Wii Remote port ${port}: ${keys}`);
          }
    
          case "dolphin_set_wiimote_pointer": {
            const port = (p.port as number | undefined) ?? 0;
            const x = p.x as number, y = p.y as number;
            await dol.call("controller.set_wiimote_pointer", [port, x, y]);
            return ok(`Set Wii Remote port ${port} pointer to (${x}, ${y})`);
          }
          case "dolphin_set_wiimote_acceleration": {
            const port = (p.port as number | undefined) ?? 0;
            const x = p.x as number, y = p.y as number, z = p.z as number;
            await dol.call("controller.set_wiimote_acceleration", [port, x, y, z]);
            return ok(`Set Wii Remote port ${port} accel to (${x}, ${y}, ${z})`);
          }
          case "dolphin_set_wiimote_angular_velocity": {
            const port = (p.port as number | undefined) ?? 0;
            const x = p.x as number, y = p.y as number, z = p.z as number;
            await dol.call("controller.set_wiimote_angular_velocity", [port, x, y, z]);
            return ok(`Set Wii Remote port ${port} angular_velocity to (${x}, ${y}, ${z})`);
          }
    
          case "dolphin_reset":  await dol.call("emulation.reset");  return ok("Reset triggered.");
    
          case "dolphin_frame_advance": {
            // Implemented client-side as polling on frame.get_count rather than
            // a bridge-side blocking wait — keeps the bridge coroutine free to
            // service other commands and avoids per-call long-hold tying up the
            // dispatcher.
            const frames = p.frames as number;
            const start = await dol.call<number>("frame.get_count");
            const target = start + frames;
            const pollEveryMs = 16;
            const overallTimeoutMs = 15000;
            const deadline = Date.now() + overallTimeoutMs;
            let now = start;
            while (now < target) {
              if (Date.now() > deadline) {
                throw new Error(`frame_advance(${frames}) timed out after ${overallTimeoutMs}ms (start=${start}, target=${target}, reached=${now}); emulator may be paused`);
              }
              await new Promise((r) => setTimeout(r, pollEveryMs));
              now = await dol.call<number>("frame.get_count");
            }
            return ok(`Advanced to frame ${now} (waited ${now - start} frames).`);
          }
    
          case "dolphin_save_state": {
            await dol.call("savestate.save_to_slot", [p.slot as number]);
            return ok(`Save state triggered for slot ${p.slot}`);
          }
          case "dolphin_load_state": {
            await dol.call("savestate.load_from_slot", [p.slot as number]);
            return ok(`Load state triggered for slot ${p.slot}`);
          }
    
          default:
            throw new Error(`Unknown tool: ${name}`);
        }
      });
    }
  • The Python bridge helper function _set_wiimote_buttons that is called when the handler dispatches 'controller.set_wiimote_buttons'. It invokes Felk's controller.set_wiimote_buttons(port, state) to actually set the Wii Remote button state in the emulator.
    def _set_wiimote_buttons(p):  controller.set_wiimote_buttons(p[0], p[1]); return None
  • The HANDLERS dictionary that maps the 'controller.set_wiimote_buttons' method string to the _set_wiimote_buttons helper function.
    HANDLERS = {
        "bridge.ping":                    _ping,
        "bridge.status":                  _status,
        "memory.read_u8":                 _read_u8,
        "memory.read_u16":                _read_u16,
        "memory.read_u32":                _read_u32,
        "memory.read_u64":                _read_u64,
        "memory.read_s8":                 _read_s8,
        "memory.read_s16":                _read_s16,
        "memory.read_s32":                _read_s32,
        "memory.read_s64":                _read_s64,
        "memory.read_bytes":              _read_bytes,
        "memory.write_u8":                _write_u8,
        "memory.write_u16":               _write_u16,
        "memory.write_u32":               _write_u32,
        "memory.write_u64":               _write_u64,
        "memory.write_s8":                _write_s8,
        "memory.write_s16":               _write_s16,
        "memory.write_s32":               _write_s32,
        "memory.write_s64":               _write_s64,
        "memory.write_bytes":             _write_bytes,
        "controller.get_gc_buttons":      _get_gc_buttons,
        "controller.set_gc_buttons":      _set_gc_buttons,
        "controller.get_wiimote_buttons": _get_wiimote_buttons,
        "controller.set_wiimote_buttons": _set_wiimote_buttons,
        "controller.get_wiimote_pointer":          _get_wiimote_pointer,
        "controller.set_wiimote_pointer":          _set_wiimote_pointer,
        "controller.get_wiimote_acceleration":     _get_wiimote_acceleration,
        "controller.set_wiimote_acceleration":     _set_wiimote_acceleration,
        "controller.get_wiimote_angular_velocity": _get_wiimote_angular_velocity,
        "controller.set_wiimote_angular_velocity": _set_wiimote_angular_velocity,
        "emulation.pause":                _pause,
        "emulation.resume":               _resume,
        "emulation.reset":                _reset,
        "savestate.save_to_slot":         _save_to_slot,
        "savestate.load_from_slot":       _load_from_slot,
        "frame.get_count":                _frame_get_count,
    }
Behavior5/5

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

With no annotations, the description fully discloses destructive behavior: 'DESTRUCTIVE to Wii Remote state... Anything you don't include is released.' It also describes the return format. This covers the key behavioral trait beyond the input schema.

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 structured into labeled sections (PURPOSE, USAGE, BEHAVIOR, RETURNS) and every sentence provides essential information without redundancy. It is front-loaded with purpose and usage, making scanning efficient.

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 the tool simplicity (2 params, no output schema), the description covers purpose, usage constraints, behavioral effect, and return value. It addresses the absence of annotations by disclosing destructive nature and limitations, making it self-sufficient for correct invocation.

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

Parameters5/5

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

Schema coverage is 100%, but the description adds value by listing valid button names and explaining the semantics of omission (released state). This supplements the schema's boolean key expectation and clarifies inventory through natural language.

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 tool's purpose: 'Set Wii Remote button state on a given port for one frame's worth of input.' It identifies the specific verb (set), resource (Wii Remote button state), and scope (one frame, port). This distinguishes it from sibling tools like dolphin_press_gc_buttons or dolphin_set_wiimote_pointer.

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 description explicitly lists supported buttons and notes that motion/pointer input and attachments are not covered, advising that games requiring those have limited control. It provides direct context on when to use this tool and its limitations, guiding the agent away from misuse.

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

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