Skip to main content
Glama
dmang-dev

mcp-retroarch

retroarch_ping

Confirm that RetroArch's Network Control Interface is accessible and retrieve its version string to verify connectivity.

Instructions

Verify connectivity to RetroArch's Network Control Interface. Returns the RetroArch version string if reachable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for retroarch_ping: calls ra.getVersion() and returns 'OK — RetroArch <version>'. This is the actual tool execution logic.
    case "retroarch_ping": {
      const v = await ra.getVersion();
      return ok(`OK — RetroArch ${v}`);
    }
  • Schema/definition of the retroarch_ping tool in the TOOLS array. Has no input parameters (empty inputSchema) and verifies connectivity to RetroArch's NCI returning the version string.
    {
      name: "retroarch_ping",
      description: "Verify connectivity to RetroArch's Network Control Interface. Returns the RetroArch version string if reachable.",
      inputSchema: { type: "object", properties: {} },
    },
  • getVersion() method on RetroArchClient: sends 'VERSION' UDP query to RetroArch and returns the trimmed response string. This is the low-level helper that the handler delegates to.
    async getVersion(): Promise<string> {
      const r = await this.query("VERSION");
      return r.toString().trim();
    }
  • src/tools.ts:176-246 (registration)
    registerTools function that registers all tools (including retroarch_ping) on the MCP server via setRequestHandler for both ListToolsRequestSchema and CallToolRequestSchema. The switch-case at line 183 dispatches to the retroarch_ping handler.
    export function registerTools(server: Server, ra: RetroArchClient): 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>;
    
        switch (name) {
          case "retroarch_ping": {
            const v = await ra.getVersion();
            return ok(`OK — RetroArch ${v}`);
          }
    
          case "retroarch_get_status": {
            const s = await ra.getStatus();
            if (s.state === "contentless") return ok("No content loaded");
            return ok(
              `State:  ${s.state}\n` +
              `System: ${s.system}\n` +
              `Game:   ${s.game}\n` +
              `CRC32:  ${s.crc32 ?? "(none reported)"}`,
            );
          }
    
          case "retroarch_get_config": {
            const v = await ra.getConfigParam(p.name as string);
            return ok(`${p.name} = ${v}`);
          }
    
          case "retroarch_read_memory": {
            const bytes = await ra.readMemory(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 "retroarch_write_memory": {
            const n = await ra.writeMemory(p.address as number, p.bytes as number[]);
            return ok(`Wrote ${n} bytes → ${addrHex(p.address as number)}`);
          }
    
          case "retroarch_read_ram": {
            const bytes = await ra.readRam(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, CHEEVOS]:\n${hex}`);
          }
    
          case "retroarch_write_ram": {
            await ra.writeRam(p.address as number, p.bytes as number[]);
            return ok(`Wrote ${(p.bytes as number[]).length} bytes → ${addrHex(p.address as number)} (CHEEVOS, no ack)`);
          }
    
          case "retroarch_pause_toggle":  await ra.pauseToggle();   return ok("Pause toggled");
          case "retroarch_frame_advance": await ra.frameAdvance();  return ok("Advanced one frame");
          case "retroarch_reset":         await ra.reset();         return ok("Game reset");
          case "retroarch_screenshot":    await ra.screenshot();    return ok("Screenshot saved to RetroArch's configured screenshot directory");
          case "retroarch_show_message": {
            await ra.showMessage(p.message as string);
            return ok(`Showed: ${p.message}`);
          }
    
          case "retroarch_save_state_current":  await ra.saveStateCurrent();          return ok("Saved to current slot");
          case "retroarch_load_state_current":  await ra.loadStateCurrent();          return ok("Loaded from current slot");
          case "retroarch_load_state_slot":     await ra.loadStateSlot(p.slot as number); return ok(`Loaded from slot ${p.slot}`);
          case "retroarch_state_slot_plus":     await ra.stateSlotPlus();             return ok("Incremented current slot");
          case "retroarch_state_slot_minus":    await ra.stateSlotMinus();            return ok("Decremented current slot");
    
          default:
            throw new Error(`Unknown tool: ${name}`);
        }
      });
    }
  • src/index.ts:18-43 (registration)
    Server creation and registration call: creates the MCP Server instance and calls registerTools(server, ra) to wire up all tools including retroarch_ping.
      const server = new Server(
        { name: "mcp-retroarch", version: "0.1.1" },
        { capabilities: { tools: {} } },
      );
      registerTools(server, ra);
    
      const transport = new StdioServerTransport();
      await server.connect(transport);
      process.stderr.write("[mcp-retroarch] MCP server ready (stdio)\n");
    
      // Background connectivity probe — fire-and-forget, never blocks the server.
      ra.connect()
        .then(() => ra.getVersion())
        .then((v) => process.stderr.write(`[mcp-retroarch] connected to ${ra.describeTarget()} — RetroArch ${v}\n`))
        .catch((err) => process.stderr.write(
          `[mcp-retroarch] note: RetroArch not reachable yet (${ra.describeTarget()}): ${err}\n` +
          `             Enable Network Commands in retroarch.cfg (network_cmd_enable / network_cmd_port)\n` +
          `             or Settings > Network > Network Commands. Tool calls will connect on demand.\n`,
        ));
    }
    
    main().catch((err) => {
      process.stderr.write(`[mcp-retroarch] fatal: ${err}\n`);
      process.exit(1);
    });
Behavior4/5

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

With no annotations, the description carries full burden. It discloses the return value (version string) upon reachability. It does not mention error behavior or side effects, but as a read-only ping, this is mostly acceptable.

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, both necessary and front-loaded. No extraneous information. Every word earns its place.

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 the simplicity (no params, no output schema), the description is mostly complete. It explains the purpose and return value. Missing details about unreachable scenarios, but acceptable for a simple ping tool.

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?

No parameters are defined, so schema coverage is 100%. The description adds value by specifying the return value, which goes beyond the empty schema. According to guidelines, 0 parameters gives a baseline of 4.

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: verifying connectivity to RetroArch's Network Control Interface and returning the version string. The verb 'verify connectivity' and specific resource distinguish it from sibling tools that perform other operations.

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?

The description implies usage as a prerequisite for other RetroArch operations, but does not explicitly state when or when not to use it, nor does it mention alternatives. The context of sibling tools suggests it's a connectivity check, but explicit guidance is lacking.

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

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