browser_get_cookies
Retrieve all browser cookies to manage authentication states, track user sessions, and maintain login persistence during automated web interactions.
Instructions
Get all cookies
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/cookieTools.ts:7-14 (handler)Inline handler for the browser_get_cookies MCP tool. No input parameters. Fetches the current browser driver, instantiates CookieService, retrieves all cookie names, and returns a formatted text response.server.tool('browser_get_cookies', 'Get all cookies', {}, async () => { const driver = stateManager.getDriver(); const cookieService = new CookieService(driver); const cookies = await cookieService.getCookies(); return { content: [{ type: 'text', text: `Cookies: ${cookies.join(', ')}` }], }; });
- src/services/cookieService.ts:6-9 (helper)Core helper method in CookieService that uses Selenium WebDriver to get all current cookies and returns an array of their names. Called by the tool handler.async getCookies(): Promise<string[]> { const cookies = await this.driver.manage().getCookies(); return cookies.map(cookie => cookie.name); }
- src/tools/index.ts:12-12 (registration)Registration of cookie tools module (including browser_get_cookies) as part of all tools registration in tools index.registerCookieTools(server, stateManager);
- src/server.ts:55-55 (registration)Top-level registration of all tools (including browser_get_cookies via chain) in the main MCP server class.registerAllTools(this.server, this.stateManager);