Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

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
NameRequiredDescriptionDefault
offsetYesOffset into main executable (hex)
instructionYesNew instruction as a 32-bit hex value (e.g. '0xD503201F')

Implementation Reference

  • 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}")
  • 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')",
        )
Behavior2/5

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

With no annotations provided, the description fails to disclose critical behavioral traits of this mutation operation: whether changes are persistent across sessions, if they affect running execution immediately, memory protection requirements, or reversibility. Only mentions the hex format which is already in schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no wasted words. The structure front-loads the core action. However, extreme brevity is inappropriate given the lack of annotations and the dangerous nature of runtime code modification.

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

Completeness2/5

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

For a destructive low-level debugging tool with no annotations and no output schema, the description is insufficient. It omits session requirements (implied by switch_start_session sibling), safety warnings, or execution effects that are essential for correct and safe invocation.

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 has 100% description coverage with clear type/format info. The description adds minimal value beyond the schema—merely confirming both parameters are hex values and implying the offset is relative to main, which the schema already specifies as 'main executable'.

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 specific action (replace), target resource (instruction), and location context (offset from main). It effectively distinguishes this from siblings like switch_no_op or switch_stub by emphasizing the arbitrary 'new instruction' replacement capability.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus similar sibling tools (switch_no_op, switch_stub) or prerequisites like requiring an active session. No mention of when replacement is preferable to other modification methods.

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