Skip to main content
Glama

sessions_continue

Continue execution to the next breakpoint in a Python debugging session, allowing step-by-step code analysis through the Debug Adapter Protocol.

Instructions

Continue execution to the next breakpoint

Input Schema

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

Implementation Reference

  • Primary MCP handler for 'sessions_continue' tool. Validates input, calls SessionManager.continue_execution_async, and formats response as JSON.
    async def _handle_sessions_continue(self, arguments: dict) -> list[TextContent]:
        """
        Handler for sessions_continue tool.
        
        Continues execution to the next breakpoint.
        """
        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 = ContinueRequest(
                file=arguments["file"],
                line=arguments["line"],
            )
    
            # Convert to BreakpointRequest (they have same structure)
            bp_request = BreakpointRequest(
                file=request.file,
                line=request.line,
            )
    
            response = await self.session_manager.continue_execution_async(
                session_id, bp_request
            )
    
            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 continuing execution")
            return [
                TextContent(
                    type="text",
                    text=json.dumps({
                        "error": {
                            "type": type(e).__name__,
                            "message": str(e),
                        }
                    }),
                )
            ]
  • Tool registration in @server.list_tools(), including name, description, and JSON schema for input validation.
    Tool(
        name="sessions_continue",
        description="Continue execution to the next breakpoint",
        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 ContinueRequest used in handler for input validation (matches MCP inputSchema).
    class ContinueRequest(BaseModel):
        """Request to continue to next breakpoint."""
        file: str = Field(..., description="Project-relative path to file")
        line: int = Field(..., ge=1, description="1-based line number")
  • Core continue_execution logic in SessionManager: validates state, dispatches to DAP or legacy BDB implementation.
    def continue_execution(
        self, session_id: str, request: BreakpointRequest
    ) -> BreakpointResponse:
        """
        Continue execution to next breakpoint within same session.
    
        Args:
            session_id: Session ID
            request: Breakpoint request with file and line
    
        Returns:
            Breakpoint response with locals at next breakpoint
    
        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)
    
        # Session must be paused (from previous breakpoint)
        if session.status != SessionStatus.PAUSED:
            return BreakpointResponse(
                hit=False,
                completed=False,
                error=ExecutionError(
                    type="InvalidStateError",
                    message=f"Cannot continue from state: {session.status}",
                ),
            )
    
        # Use DAP if enabled (default)
        if session.use_dap:
            return self._continue_execution_dap(session, breakpoint_path, request.line)
        else:
            return self._continue_execution_bdb(session, breakpoint_path, request.line)
  • Async wrapper continue_execution_async called from MCP handler.
    async def continue_execution_async(
        self, session_id: str, request: BreakpointRequest
    ) -> BreakpointResponse:
        """
        Async wrapper for continue_execution.
        
        Runs the synchronous continue_execution in a thread pool to avoid blocking.
        """
        return await asyncio.to_thread(self.continue_execution, session_id, request)

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