switch_replace
Replace instructions at specific offsets in Nintendo Switch executables to modify code behavior during debugging with gdb-multiarch.
Instructions
Replace the instruction at an offset from main with a new instruction. Offset and instruction are both hex values.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| offset | Yes | Offset into main executable (hex) | |
| instruction | Yes | New instruction as a 32-bit hex value (e.g. '0xD503201F') |
Implementation Reference
- src/gdb_multiarch_mcp/server.py:540-542 (handler)The handler logic for the switch_replace tool, which uses ReplaceArgs to execute the 'replace' command on the session.
elif name == "switch_replace": a = ReplaceArgs(**arguments) result = session.execute_command(f"replace {a.offset} {a.instruction}") - src/gdb_multiarch_mcp/server.py:369-376 (registration)Registration of the 'switch_replace' tool definition in the server.
Tool( name="switch_replace", description=( "Replace the instruction at an offset from main with a new instruction. " "Offset and instruction are both hex values." ), inputSchema=ReplaceArgs.model_json_schema(), ), - Input schema definition for the switch_replace tool.
class ReplaceArgs(BaseModel): offset: str = Field(..., description="Offset into main executable (hex)") instruction: str = Field( ..., description="New instruction as a 32-bit hex value (e.g. '0xD503201F')", )