Skip to content

Commit 27330e5

Browse files
author
rocketraccoon
committed
feat(mcp-tools): fix open new browser after close
1 parent 3ac5847 commit 27330e5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/tools/attach-to-browser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ const attachToBrowserCb: ToolCallback<typeof attachToBrowserSchema> = async args
1313
const browserContext = new BrowserContext({}, session as SessionOptions);
1414
await browserContext.get();
1515

16+
if (await contextProvider.getContext().browser.isActive()) {
17+
console.error("Closing existing browser");
18+
await contextProvider.getContext().browser.close();
19+
}
20+
1621
contextProvider.setContext({
1722
browser: browserContext,
1823
} as Context);

0 commit comments

Comments
 (0)