Skip to main content
Glama
sbergeron42

gdb-multiarch-mcp

by sbergeron42

switch_stub

Patch Nintendo Switch executables to make functions return immediately by writing ARM64 RET instructions at specified offsets from main, useful for debugging in gdb-multiarch.

Instructions

Stub the function at the given offset from main. Writes ARM64 RET (0xD65F03C0) at $main+offset, making the function return immediately.

Input Schema

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

Implementation Reference

  • The handler logic for the switch_stub tool, which parses the arguments and calls the GDB session to execute the 'stub' command.
    elif name == "switch_stub":
        a = OffsetArgs(**arguments)
        result = session.execute_command(f"stub {a.offset}")
  • The tool registration block for switch_stub in the MCP server setup.
    Tool(
        name="switch_stub",
        description=(
            "Stub the function at the given offset from main. "
            "Writes ARM64 RET (0xD65F03C0) at $main+offset, making the function "
            "return immediately."
        ),
        inputSchema=OffsetArgs.model_json_schema(),
    ),
Behavior4/5

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

No annotations are provided, so description carries full burden. It excellently discloses the specific bytes written (0xD65F03C0), architecture (ARM64), and immediate effect (function returns immediately). Minor gap: doesn't mention whether the patch persists, is reversible, or what return value the stubbed function yields.

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 with zero waste: first states the action and target, second explains the mechanism and immediate behavioral consequence. Information is front-loaded and every clause 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 this is a binary patching tool with no output schema, the description adequately covers the immediate side effects. However, for a destructive write operation, it could mention whether the change is persistent across sessions or reversible (e.g., can the original bytes be restored?).

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?

Schema coverage is 100% with clear parameter description, establishing baseline 3. Description adds crucial semantic context that the offset is 'from main' (base address), reinforcing the calculation '$main+offset' which is essential for correct invocation in a debugging context.

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?

Description provides specific verb ('Stub') + resource ('function at the given offset from main') and distinguishes from siblings by specifying it writes 'ARM64 RET (0xD65F03C0)'—clearly differentiating from switch_no_op or switch_replace which would write different instructions.

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 through mechanism explanation ('making the function return immediately'), but provides no explicit guidance on when to choose this over siblings like switch_no_op or switch_replace, nor any prerequisites or warnings about usage context.

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