Skip to main content
Glama

lldb_analyze_crash

Read-onlyIdempotent

Analyze program crashes and core dumps to identify root causes by examining backtraces, register states, and local variables.

Instructions

Analyze a crashed program or core dump to determine the cause.

This tool loads a core dump or crashed executable and provides:
- Backtrace showing the crash location
- Register state at crash time
- Local variables in the crash frame
- Loaded modules information

Args:
    params: AnalyzeCrashInput with executable path and optional core file

Returns:
    str: Crash analysis including backtrace, registers, and variables

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function implementing the tool's logic: creates LLDB target from executable/core dump, runs commands for backtrace (bt all), registers, frame variables, and image list, then formats output as Markdown or JSON.
    async def lldb_analyze_crash(params: AnalyzeCrashInput) -> str:
        """Analyze a crashed program or core dump to determine the cause.
    
        This tool loads a core dump or crashed executable and provides:
        - Backtrace showing the crash location
        - Register state at crash time
        - Local variables in the crash frame
        - Loaded modules information
    
        Args:
            params: AnalyzeCrashInput with executable path and optional core file
    
        Returns:
            str: Crash analysis including backtrace, registers, and variables
        """
        commands = []
    
        if params.core_file:
            commands.append(f"target create {params.executable} --core {params.core_file}")
        else:
            commands.append(f"target create {params.executable}")
    
        commands.extend(["bt all", "register read", "frame variable", "image list"])
    
        result = _run_lldb_script(commands, working_dir=params.working_dir)
    
        if params.response_format == ResponseFormat.JSON:
            return json.dumps(
                {
                    "success": result["success"],
                    "executable": params.executable,
                    "core_file": params.core_file,
                    "output": result["output"],
                    "error": result.get("error"),
                },
                indent=2,
            )
    
        # Markdown format
        lines = [f"# Crash Analysis: {Path(params.executable).name}", ""]
    
        if params.core_file:
            lines.append(f"**Core file:** {params.core_file}")
            lines.append("")
    
        if result["success"]:
            lines.append("## Analysis Output")
            lines.append("```")
            lines.append(result["output"].strip())
            lines.append("```")
        else:
            lines.append("## Error")
            lines.append(f"```\n{result.get('error', 'Unknown error')}\n```")
    
        return "\n".join(lines)
  • Pydantic BaseModel defining the input parameters for the tool: required executable path, optional core file, response format (markdown/json), and working directory.
    class AnalyzeCrashInput(BaseModel):
        """Input for analyzing a crashed program."""
    
        model_config = ConfigDict(str_strip_whitespace=True)
    
        executable: str = Field(..., description="Path to the executable that crashed", min_length=1)
        core_file: str | None = Field(default=None, description="Path to the core dump file (optional)")
        response_format: ResponseFormat = Field(
            default=ResponseFormat.MARKDOWN,
            description="Output format: 'markdown' for human-readable or 'json' for structured data",
        )
        working_dir: str | None = Field(default=None, description="Working directory for the analysis")
  • MCP decorator registering the tool with name 'lldb_analyze_crash' and annotations indicating it's read-only, idempotent, non-destructive, and not open-world.
    @mcp.tool(
        name="lldb_analyze_crash",
        annotations={
            "title": "Analyze Crash Dump",
            "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 declare readOnlyHint=true, destructiveHint=false, idempotentHint=true, and openWorldHint=false, covering safety and idempotency. The description adds useful context about what the analysis provides (backtrace, registers, variables, modules), but does not disclose rate limits, authentication needs, or detailed behavioral traits beyond the annotations.

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 with the core purpose, followed by bullet points detailing outputs and clear sections for Args and Returns. Every sentence adds value without redundancy, making it efficient and easy to parse.

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

Completeness5/5

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

Given the tool's complexity, the description is complete enough: it explains the purpose, lists analysis outputs, references parameters, and specifies the return type. With annotations covering safety and idempotency, and an output schema implied by the Returns section, no critical information is missing for effective tool selection.

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?

With schema description coverage at 0%, the description minimally references parameters ('executable path and optional core file'), but does not add meaningful semantics beyond what the input schema already defines in detail for executable, core_file, response_format, and working_dir. The baseline is appropriate given the schema's comprehensive parameter 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?

The description clearly states the specific action ('analyze a crashed program or core dump') and resource ('crashed program or core dump'), distinguishing it from siblings like lldb_backtrace or lldb_registers by emphasizing comprehensive crash analysis rather than isolated debugging operations.

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 implicitly suggests usage for crash investigation ('to determine the cause'), but does not explicitly state when to use this tool versus alternatives like lldb_backtrace or lldb_examine_variables, nor does it provide exclusions or prerequisites for its use.

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