Skip to main content
Glama

sessions_breakpoint

Execute code to a breakpoint and capture local variables for debugging Python applications using the Debug Adapter Protocol.

Instructions

Run to a breakpoint and capture local variables

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesThe debug session ID
fileYesProject-relative file path
lineYesLine number (1-based)

Implementation Reference

  • MCP tool handler for 'sessions_breakpoint'. Extracts sessionId, file, line from arguments, creates BreakpointRequest, calls SessionManager.run_to_breakpoint_async, and returns JSON-serialized response or error.
    async def _handle_sessions_breakpoint(self, arguments: dict) -> list[TextContent]:
        """
        Handler for sessions_breakpoint tool.
        
        Runs to a breakpoint and captures local variables.
        """
        try:
            session_id = arguments.get("sessionId")
            if not session_id:
                return [
                    TextContent(
                        type="text",
                        text=json.dumps({
                            "error": {
                                "type": "ValueError",
                                "message": "sessionId is required",
                            }
                        }),
                    )
                ]
    
            request = BreakpointRequest(
                file=arguments["file"],
                line=arguments["line"],
            )
    
            response = await self.session_manager.run_to_breakpoint_async(
                session_id, request
            )
    
            # Convert response to dict
            result = response.model_dump()
    
            return [
                TextContent(
                    type="text",
                    text=json.dumps(result),
                )
            ]
        except KeyError as e:
            return [
                TextContent(
                    type="text",
                    text=json.dumps({
                        "error": {
                            "type": "SessionNotFound",
                            "message": str(e),
                        }
                    }),
                )
            ]
        except Exception as e:
            logger.exception("Error at breakpoint")
            return [
                TextContent(
                    type="text",
                    text=json.dumps({
                        "error": {
                            "type": type(e).__name__,
                            "message": str(e),
                        }
                    }),
                )
            ]
  • Registers the 'sessions_breakpoint' tool with the MCP server via list_tools(), including name, description, and inputSchema for validation.
    Tool(
        name="sessions_breakpoint",
        description="Run to a breakpoint and capture local variables",
        inputSchema={
            "type": "object",
            "properties": {
                "sessionId": {
                    "type": "string",
                    "description": "The debug session ID",
                },
                "file": {
                    "type": "string",
                    "description": "Project-relative file path",
                },
                "line": {
                    "type": "integer",
                    "description": "Line number (1-based)",
                    "minimum": 1,
                },
            },
            "required": ["sessionId", "file", "line"],
        },
    ),
  • Pydantic model BreakpointRequest used for type-safe input validation in the handler, matching the tool's inputSchema.
    class BreakpointRequest(BaseModel):
        """Request to run to a breakpoint."""
        file: str = Field(..., description="Project-relative path to file")
        line: int = Field(..., ge=1, description="1-based line number")
  • Core implementation in SessionManager: validates breakpoint, dispatches to DAP or BDB mode to execute run-to-breakpoint and capture locals.
    def run_to_breakpoint(
        self, session_id: str, request: BreakpointRequest, timeout: float | None = None
    ) -> BreakpointResponse:
        """
        Run session to a breakpoint and capture locals.
    
        Args:
            session_id: Session ID
            request: Breakpoint request with file and line
            timeout: Optional timeout in seconds (defaults to DEFAULT_TIMEOUT_SECONDS)
    
        Returns:
            Breakpoint response with locals
    
        Raises:
            KeyError: If session not found
            ValueError: If file/line is invalid
        """
        session = self.get_session(session_id)
    
        # Validate breakpoint location using session's workspace root
        breakpoint_path = resolve_workspace_path(session.workspace_root, request.file)
        validate_file_and_line(breakpoint_path, request.line)
    
        # Use default timeout if not specified
        if timeout is None:
            timeout = DEFAULT_TIMEOUT_SECONDS
    
        # Use DAP if enabled (default)
        if session.use_dap:
            return self._run_to_breakpoint_dap(session, breakpoint_path, request.line, timeout)
        else:
            return self._run_to_breakpoint_bdb(session, breakpoint_path, request.line, timeout)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the action and outcome but lacks details on permissions, side effects (e.g., whether execution pauses or resumes after), error handling, or rate limits. For a debugging tool with potential mutation effects, this is a significant gap in transparency.

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 a single, efficient sentence that front-loads the core action and outcome without unnecessary words. Every part of the sentence earns its place by clearly conveying the tool's purpose, making it highly concise and well-structured.

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

Completeness3/5

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

Given the complexity of a debugging tool with no annotations and no output schema, the description is minimally adequate. It states what the tool does but lacks details on behavioral traits, return values, or error conditions. For a tool that interacts with debug sessions, more context on execution flow and results would improve completeness.

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 100%, so the input schema already documents all parameters (sessionId, file, line) with clear descriptions. The description does not add any additional meaning, syntax, or format details beyond what the schema provides, resulting in a baseline score of 3 where the schema handles the parameter documentation adequately.

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 ('Run to a breakpoint') and the outcome ('capture local variables'), distinguishing it from sibling tools like sessions_continue (continue execution) or sessions_step_* (step through code). It precisely defines what the tool does without being vague or tautological.

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 in a debugging context to stop at a specific breakpoint and gather variable data, but it does not explicitly state when to use this tool versus alternatives like sessions_step_over (step over a line) or sessions_continue (resume execution). No exclusions or prerequisites are mentioned, leaving usage context inferred rather than clearly defined.

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/Kaina3/Debug-MCP'

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