Skip to main content
Glama

lldb_disassemble

Read-onlyIdempotent

View assembly instructions by disassembling machine code from functions, address ranges, or current execution frames in C/C++ programs.

Instructions

Disassemble machine code to view assembly instructions.

Can disassemble:
- A named function: 'main', 'MyClass::method'
- An address range: '0x1000-0x1100' or '0x1000 0x1100'
- Current frame (when stopped at breakpoint)

Options:
- show_bytes: Include raw opcode bytes
- mixed: Interleave source code with assembly

Args:
    params: DisassembleInput with target and display options

Returns:
    str: Assembly listing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main handler function that constructs and executes LLDB 'disassemble' commands based on input parameters, supporting functions, addresses, ranges, with options for showing bytes and mixed source+asm.
    async def lldb_disassemble(params: DisassembleInput) -> str:
        """Disassemble machine code to view assembly instructions.
    
        Can disassemble:
        - A named function: 'main', 'MyClass::method'
        - An address range: '0x1000-0x1100' or '0x1000 0x1100'
        - Current frame (when stopped at breakpoint)
    
        Options:
        - show_bytes: Include raw opcode bytes
        - mixed: Interleave source code with assembly
    
        Args:
            params: DisassembleInput with target and display options
    
        Returns:
            str: Assembly listing
        """
        commands = [f"target create {params.executable}"]
    
        dis_cmd = "disassemble"
    
        if "-" in params.target and params.target.startswith("0x"):
            # Address range
            parts = params.target.split("-")
            dis_cmd += f" --start-address {parts[0]} --end-address {parts[1]}"
        elif params.target.startswith("0x"):
            # Single address
            dis_cmd += f" --start-address {params.target} --count 50"
        elif params.target.lower() == "current":
            dis_cmd += " --frame"
        else:
            # Function name
            dis_cmd += f" --name {params.target}"
    
        if params.show_bytes:
            dis_cmd += " --bytes"
        if params.mixed:
            dis_cmd += " --mixed"
    
        commands.append(dis_cmd)
    
        result = _run_lldb_script(commands)
    
        return f"## Disassembly: `{params.target}`\n\n```asm\n{result['output'].strip()}\n```"
  • Pydantic input model validating parameters: executable path, disassembly target (function/address/'current'), flags for bytes and mixed mode.
    class DisassembleInput(BaseModel):
        """Input for disassembling code."""
    
        model_config = ConfigDict(str_strip_whitespace=True)
    
        executable: str = Field(..., description="Path to the executable", min_length=1)
        target: str = Field(
            ...,
            description="What to disassemble: function name, address range (e.g., '0x1000-0x1100'), or 'current' for current frame",
            min_length=1,
        )
        show_bytes: bool = Field(default=False, description="Show opcode bytes alongside instructions")
        mixed: bool = Field(default=False, description="Show mixed source and assembly")
  • MCP tool registration decorator specifying the tool name and annotations for read-only, non-destructive behavior.
    @mcp.tool(
        name="lldb_disassemble",
        annotations={
            "title": "Disassemble Code",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": False,
        },
    )
Behavior3/5

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

Annotations already indicate readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=false, covering safety and idempotency. The description adds useful context about the tool's scope (e.g., working with breakpoints) and display options (show_bytes, mixed), but does not detail aspects like rate limits, authentication needs, or error handling beyond what annotations provide.

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?

The description is well-structured and front-loaded, starting with the core purpose, followed by bullet points for use cases and options, and ending with args and returns. Each sentence adds value without redundancy, making it efficient and easy to scan.

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 tool's moderate complexity, rich annotations, and presence of an output schema (which handles return values), the description is largely complete. It covers purpose, usage, and parameters well, though it could benefit from more behavioral details like error cases or performance considerations to be fully comprehensive.

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?

With 0% schema description coverage, the schema provides no parameter descriptions. The description compensates by explaining the 'target' parameter with examples (function names, address ranges, 'current'), and outlines 'show_bytes' and 'mixed' options, adding meaningful semantics. However, it does not cover the 'executable' parameter, leaving a minor gap.

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 tool's purpose with a specific verb ('disassemble') and resource ('machine code'), explaining it converts machine code to assembly instructions. It distinguishes itself from siblings like lldb_read_memory or lldb_symbols by focusing on disassembly rather than memory reading or symbol lookup.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool by listing three specific use cases (named function, address range, current frame), which helps guide selection. However, it does not explicitly mention when not to use it or name alternatives among sibling tools, such as using lldb_read_memory for raw memory access instead.

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/benpm/claude_lldb_mcp'

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