Skip to main content
Glama

lldb_threads

Read-onlyIdempotent

List all threads with their IDs, names, execution points, and stop reasons to debug multithreaded C/C++ programs using LLDB.

Instructions

List all threads and their current state.

Shows:
- Thread IDs and names
- Current execution point for each thread
- Stop reason (if stopped)
- Optionally: backtrace for each thread

Args:
    params: ThreadsInput with executable and optional core file

Returns:
    str: Thread listing with state information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function that executes LLDB commands to examine threads in a target executable or core dump.
    async def lldb_threads(params: ThreadsInput) -> str:
        """List all threads and their current state.
    
        Shows:
        - Thread IDs and names
        - Current execution point for each thread
        - Stop reason (if stopped)
        - Optionally: backtrace for each thread
    
        Args:
            params: ThreadsInput with executable and optional core file
    
        Returns:
            str: Thread listing with state information
        """
        commands = []
    
        if params.core_file:
            commands.append(f"target create {params.executable} --core {params.core_file}")
        else:
            commands.append(f"target create {params.executable}")
            if params.breakpoint:
                commands.append(f"breakpoint set --name {params.breakpoint}")
                commands.append("run")
    
        commands.append("thread list")
    
        if params.show_backtrace:
            commands.append("thread backtrace all")
    
        if not params.core_file:
            commands.append("quit")
    
        result = _run_lldb_script(commands)
    
        return f"## Threads\n\n```\n{result['output'].strip()}\n```"
  • Pydantic BaseModel defining the input parameters for the lldb_threads tool.
    class ThreadsInput(BaseModel):
        """Input for examining threads."""
    
        model_config = ConfigDict(str_strip_whitespace=True)
    
        executable: str = Field(..., description="Path to the executable", min_length=1)
        breakpoint: str | None = Field(default=None, description="Breakpoint location to stop at")
        core_file: str | None = Field(default=None, description="Path to core dump file")
        show_backtrace: bool = Field(default=False, description="Show backtrace for each thread")
  • MCP decorator that registers the lldb_threads tool with the specified name and annotations.
    @mcp.tool(
        name="lldb_threads",
        annotations={
            "title": "Examine Threads",
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
            "openWorldHint": False,
        },
    )
Behavior4/5

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

Annotations already provide readOnlyHint=true, destructiveHint=false, and idempotentHint=true, indicating a safe, non-destructive read operation. The description adds valuable context beyond annotations: it specifies what information is shown (thread IDs, names, execution points, stop reasons, optional backtraces) and mentions the return format ('Thread listing with state information'). This enhances understanding of the tool's behavior without contradicting annotations.

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?

The description is well-structured with clear sections: purpose statement, 'Shows' list, 'Args', and 'Returns'. It's front-loaded with the main purpose. However, the 'Shows' section could be more concise, and the parameter documentation is minimal. Overall, it's efficient but has minor room for improvement.

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 (debugging threads), rich annotations (read-only, idempotent), and the presence of an output schema (implied by 'Returns: str'), the description is mostly complete. It covers purpose, output format, and parameters at a high level. However, it lacks details on parameter usage (e.g., how breakpoint interacts with thread listing) and doesn't mention sibling tool relationships, leaving some contextual gaps.

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 description coverage is 0%, meaning the schema provides no parameter descriptions. The description compensates by listing parameters in the 'Args' section: 'params: ThreadsInput with executable and optional core file.' However, it doesn't detail the four sub-parameters (executable, breakpoint, core_file, show_backtrace) or their semantics. With 0% coverage, the description adds some value but doesn't fully document the parameters.

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: 'List all threads and their current state.' It specifies the exact resource (threads) and action (list with state information). The title 'Examine Threads' from annotations reinforces this, and it distinguishes from siblings like lldb_backtrace (which focuses on call stacks) and lldb_registers (which examines register values).

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 the 'Shows' section, indicating this tool is for examining thread states during debugging. However, it doesn't explicitly state when to use this versus alternatives like lldb_backtrace (which might show backtraces without thread listings) or lldb_analyze_crash (for crash-specific analysis). No exclusions or prerequisites are mentioned.

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