@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
4
4
// @ts -ignore
5
5
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6
- import { defineTool , navigate , common , snapshot , keyboard , getText , session , Context , resolveConfig , PageSnapshot , enableDefaultSessionCreation } from "@mcp/core" ;
6
+ import { defineTool , navigate , common , snapshot , keyboard , getText , session , Context , resolveConfig , PageSnapshot } from "@mcp/core" ;
7
7
import { withMcpAuth } from "@/lib/auth" ;
8
8
import { loadCtx , saveCtx , type CachedResources , type CachedSnapshot , deleteCtx } from "@/lib/redis" ;
9
9
@@ -121,9 +121,7 @@ const mcpServerFactory = (req: Request) => async (server: any) => {
121
121
if ( tool . schema . name === "browserbase_session_close" ) {
122
122
// Run the tool with the rehydrated context
123
123
const result = await callContext . run ( tool , params ) ;
124
-
125
- // This is the important part: We delete the context from Redis
126
- // to prevent accessing the default session on subsequent calls
124
+
127
125
try {
128
126
await deleteCtx ( browserbaseProjectId ) ;
129
127
console . log ( `Deleted cached context for ${ browserbaseProjectId } after session close` ) ;
@@ -133,13 +131,7 @@ const mcpServerFactory = (req: Request) => async (server: any) => {
133
131
134
132
return result ;
135
133
}
136
- // At the beginning of each new request, always re-enable session creation
137
- // in case it was disabled by a previous session close operation
138
134
else if ( tool . schema . name !== "browserbase_session_close" ) {
139
- // Re-enable default session creation for any tool that isn't session close
140
- enableDefaultSessionCreation ( ) ;
141
- console . log ( `Re-enabled default session creation for tool: ${ tool . schema . name } ` ) ;
142
-
143
135
// Special handling for tools that require active snapshots to be reconnected
144
136
if ( tool . schema . name . startsWith ( 'browserbase_' ) &&
145
137
! [ 'browserbase_session_create' , 'browserbase_session_close' , 'browserbase_snapshot' , 'browserbase_navigate' ] . includes ( tool . schema . name ) ) {
0 commit comments