Skip to main content
Glama

lldb_watchpoint

Set watchpoints to pause program execution when specific variables are accessed, enabling precise debugging of memory interactions in C/C++ code.

Instructions

Set a watchpoint to break when a variable is accessed.

Watch types:
- 'write': Break when value is written (modified)
- 'read': Break when value is read
- 'read_write': Break on any access

Args:
    params: WatchpointInput with variable and access type

Returns:
    str: Confirmation of watchpoint creation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'lldb_watchpoint' tool. It constructs LLDB commands to create a target, set a watchpoint on the specified variable with the given watch type and optional condition, lists the watchpoints, executes them using _run_lldb_script, and formats the output.
    async def lldb_watchpoint(params: WatchpointInput) -> str:
        """Set a watchpoint to break when a variable is accessed.
    
        Watch types:
        - 'write': Break when value is written (modified)
        - 'read': Break when value is read
        - 'read_write': Break on any access
    
        Args:
            params: WatchpointInput with variable and access type
    
        Returns:
            str: Confirmation of watchpoint creation
        """
        commands = [f"target create {params.executable}"]
    
        wp_cmd = f"watchpoint set variable {params.variable}"
    
        if params.watch_type == "read":
            wp_cmd += " --watch read"
        elif params.watch_type == "read_write":
            wp_cmd += " --watch read_write"
        # Default is write
    
        commands.append(wp_cmd)
    
        if params.condition:
            commands.append(f"watchpoint modify --condition '{params.condition}'")
    
        commands.append("watchpoint list")
    
        result = _run_lldb_script(commands)
    
        return f"## Watchpoint on `{params.variable}`\n\n```\n{result['output'].strip()}\n```"
  • Pydantic BaseModel defining the input parameters for the lldb_watchpoint tool, including executable path, variable to watch, watch type, and optional condition.
    class WatchpointInput(BaseModel):
        """Input for setting watchpoints."""
    
        model_config = ConfigDict(str_strip_whitespace=True)
    
        executable: str = Field(..., description="Path to the executable", min_length=1)
        variable: str = Field(..., description="Variable name or memory address to watch", min_length=1)
        watch_type: str = Field(
            default="write", description="Type of access to watch: 'write', 'read', 'read_write'"
        )
        condition: str | None = Field(
            default=None, description="Conditional expression for the watchpoint"
        )
  • MCP tool registration decorator that registers the lldb_watchpoint handler function with the FastMCP server, including name and annotations for the tool.
    @mcp.tool(
        name="lldb_watchpoint",
        annotations={
            "title": "Set Watchpoint",
            "readOnlyHint": False,
            "destructiveHint": False,
            "idempotentHint": False,
            "openWorldHint": False,
        },
    )
Behavior4/5

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

Annotations indicate this is a non-readOnly, non-destructive operation, but the description adds valuable behavioral context: it explains what triggers the break (variable access), defines three specific watch types with their behaviors, and mentions the confirmation return. This goes beyond annotations by detailing the tool's specific debugging behavior and output.

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 efficiently structured with a clear purpose statement, bullet-pointed watch type definitions, and labeled Args/Returns sections. Every sentence adds value with no redundancy. The information is front-loaded with the core functionality stated first.

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 operation with multiple watch types), good annotations, and the presence of an output schema (which handles return value documentation), the description is reasonably complete. It covers the core behavior, watch type semantics, and basic parameter context, though additional parameter details would improve completeness further.

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 0% schema description coverage (the schema has descriptions but they're not counted in coverage), the description provides some parameter context by mentioning 'variable and access type' and listing watch types, but doesn't explain the executable parameter, condition parameter, or the nested WatchpointInput structure. It adds partial meaning but doesn't fully compensate for the schema coverage 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 specific action ('Set a watchpoint to break') and resource ('when a variable is accessed'), distinguishing it from sibling tools like lldb_set_breakpoint (which likely sets breakpoints at code locations) or lldb_examine_variables (which likely inspects variable values). The description explicitly defines what a watchpoint does in this debugging context.

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 context (debugging with LLDB when needing to monitor variable access) but doesn't explicitly state when to use this tool versus alternatives like lldb_set_breakpoint or lldb_examine_variables. It provides watch type definitions that help understand different use cases, but lacks explicit guidance on tool selection.

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