Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

switch_prepare_rehook

Generate commands to restore original instructions after hooking by dumping 16 bytes at a specified offset in Nintendo Switch executables.

Instructions

Dump the original instructions at an offset (4 instructions / 16 bytes) as 'replace' commands, so you can restore them after hooking.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
offsetYesOffset into main executable (hex, e.g. '0x3a5f10' or '3a5f10')

Implementation Reference

  • The handler for the switch_prepare_rehook tool, which executes the command via the GDB session.
    elif name == "switch_prepare_rehook":
        a = OffsetArgs(**arguments)
        result = session.execute_command(f"prepare_rehook {a.offset}")
  • Registration of the switch_prepare_rehook tool within the MCP tool list.
    Tool(
        name="switch_prepare_rehook",
        description=(
            "Dump the original instructions at an offset (4 instructions / 16 bytes) "
            "as 'replace' commands, so you can restore them after hooking."
        ),
        inputSchema=OffsetArgs.model_json_schema(),
    ),
Behavior3/5

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

With no annotations provided, the description carries the full burden. It adequately explains the 16-byte read scope and output format ('replace' commands), but omits critical operational details: whether this requires an active debugging session, the exact output format/destination, and whether it has any side effects on target memory.

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?

Single dense sentence efficiently communicates action, parameter context, data volume (4 instructions/16 bytes), output format, and purpose. No redundant words; every clause provides necessary technical context for a low-level debugging tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Appropriate for a single-parameter tool, but gaps remain given the absence of annotations and output schema. Missing: session state requirements (likely requires switch_start_session), whether output goes to console or a buffer, and error conditions (invalid offset, unreadable memory).

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

Parameters3/5

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

Schema coverage is 100%, establishing a baseline of 3. The description references the offset parameter contextually ('at an offset') and clarifies the operation reads 16 bytes from that location, adding domain-specific meaning about the hooking window size that complements the schema's format documentation.

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?

Specific verb ('dump'), resource ('original instructions'), and scope ('4 instructions / 16 bytes') clearly distinguish this from sibling tools like switch_replace (which applies replacements) and switch_stub (which inserts code). The purpose—saving state for later restoration—is unambiguous.

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?

Implies the temporal context ('after hooking') suggesting it should be used before modifying code, but lacks explicit sequencing guidance like 'Use before switch_replace' or prerequisite notes regarding active sessions (implied by sibling switch_start_session but not stated).

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