Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

switch_start_session

Initialize debugging for Nintendo Switch executables by connecting to the GDB stub, loading debug commands, and setting up the game's base address automatically.

Instructions

Start gdb-multiarch and connect to the Switch/Yuzu GDB stub. This MUST be called before any other tool. Connects to the IP/port configured via SWITCH_IP and SWITCH_PORT environment variables (defaults: 192.168.1.235:22225). Automatically loads Switch debug commands, attaches to the game, and sets $main to the base address of cross2_Release.nss. Do NOT manually run 'target remote', 'attach', or 'set $main' — this tool handles all of that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The _start_session function implements the logic to initialize the GDB session, deploy necessary scripts, and connect to the target.
    def _start_session() -> dict:
        """
        Start a gdb-multiarch session and connect to Yuzu.
    
        Uses DEFAULT_SWITCH_IP:DEFAULT_SWITCH_PORT, sources the Switch gdbinit
        commands, runs attach.py to auto-attach and set $main.
        """
        global _session
        with _session_lock:
            if _session is not None and _session.is_running:
                return {"status": "error", "message": "Session already running. Stop it first."}
    
            scripts_dir = _deploy_scripts()
    
            _session = GDBSession()
            init_cmds = [
                f"source {scripts_dir}/gdbinit_switch",
                f"target extended-remote {DEFAULT_SWITCH_IP}:{DEFAULT_SWITCH_PORT}",
                f"source {scripts_dir}/attach.py",
            ]
    
            result = _session.start(init_commands=init_cmds)
    
            if result.get("status") == "error":
                logger.error(f"Start failed: {result.get('message')}")
                _session = None
    
            return result
  • Tool definition and registration for 'switch_start_session' in the list_tools method.
    Tool(
        name="switch_start_session",
        description=(
            "Start gdb-multiarch and connect to the Switch/Yuzu GDB stub. "
            "This MUST be called before any other tool. "
            "Connects to the IP/port configured via SWITCH_IP and SWITCH_PORT "
            "environment variables (defaults: 192.168.1.235:22225). "
            "Automatically loads Switch debug commands, attaches to the game, "
            "and sets $main to the base address of cross2_Release.nss. "
            "Do NOT manually run 'target remote', 'attach', or 'set $main' — "
            "this tool handles all of that."
        ),
        inputSchema=NO_ARGS_SCHEMA,
    ),
  • Dispatch logic in the call_tool function that routes the 'switch_start_session' tool call to the _start_session handler.
    if name == "switch_start_session":
        result = _start_session()
Behavior4/5

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

With no annotations provided, the description carries full disclosure burden. It successfully documents the configuration mechanism (SWITCH_IP/PORT env vars with defaults), specific automated actions (loading Switch debug commands, attaching, setting $main to cross2_Release.nss base), and the specific executable used (gdb-multiarch). Minor gap: does not specify error behavior on connection failure or idempotency of repeated calls.

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?

Four sentences, zero redundancy. Front-loaded with the core action, followed by mandatory prerequisite warning, configuration details, automated behaviors, and prohibitions. Each sentence conveys distinct operational information (what, when, how, what-not).

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 lack of annotations and output schema, the description adequately covers the initialization lifecycle, environment configuration, and specific technical automation (cross2_Release.nss base address). Minor deduction for not describing return values, error states, or session termination conditions given this is a stateful connection establishment 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?

Input schema has zero parameters, warranting a baseline of 4. The description adds value by documenting implicit configuration inputs (environment variables SWITCH_IP and SWITCH_PORT) and their default values (192.168.1.235:22225), effectively serving as parameter documentation outside 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 opens with specific verbs ('Start gdb-multiarch and connect') and clearly identifies the target resource (Switch/Yuzu GDB stub). It effectively distinguishes itself from the 20+ sibling tools by establishing its role as the mandatory initialization step.

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?

Provides explicit temporal ordering ('MUST be called before any other tool') and explicitly prohibits manual alternatives ('Do NOT manually run target remote, attach, or set $main'). This creates clear boundaries between this tool and both its siblings and manual GDB workflows.

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/sbergeron42/gdb-multiarch-mcp'

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