browser_delete_cookie
Remove a specific cookie from the browser to manage session data, clear authentication tokens, or comply with privacy requirements during automated web testing.
Instructions
Delete a cookie from the browser
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the cookie to delete |
Implementation Reference
- src/tools/cookieTools.ts:71-78 (handler)The inline handler function for the 'browser_delete_cookie' tool. It retrieves the WebDriver instance, instantiates CookieService, calls deleteCookie on it with the provided name, and returns a success message.async ({ name }) => { const driver = stateManager.getDriver(); const cookieService = new CookieService(driver); await cookieService.deleteCookie(name); return { content: [{ type: 'text', text: `Deleted cookie: ${name}` }], }; }
- src/tools/cookieTools.ts:68-70 (schema)Zod input schema defining the 'name' parameter for the 'browser_delete_cookie' tool.{ name: z.string().describe('Name of the cookie to delete'), },
- src/tools/cookieTools.ts:65-79 (registration)Direct registration of the 'browser_delete_cookie' tool using server.tool(), including schema and inline handler.server.tool( 'browser_delete_cookie', 'Delete a cookie from the browser', { name: z.string().describe('Name of the cookie to delete'), }, async ({ name }) => { const driver = stateManager.getDriver(); const cookieService = new CookieService(driver); await cookieService.deleteCookie(name); return { content: [{ type: 'text', text: `Deleted cookie: ${name}` }], }; } );
- src/services/cookieService.ts:64-66 (helper)CookieService helper method that executes the Selenium WebDriver command to delete a cookie by name.async deleteCookie(name: string): Promise<void> { await this.driver.manage().deleteCookie(name); }
- src/tools/index.ts:12-12 (registration)Higher-level registration call for all cookie tools, including 'browser_delete_cookie', within registerAllTools.registerCookieTools(server, stateManager);