browser_delete_cookie
Remove specific cookies from the browser to manage user sessions, clear tracking data, or maintain privacy during automated web testing and browsing sessions.
Instructions
Delete a cookie from the browser
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the cookie to delete |
Input Schema (JSON Schema)
{
"properties": {
"name": {
"description": "Name of the cookie to delete",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}
Implementation Reference
- src/tools/cookieTools.ts:71-78 (handler)The handler function for the browser_delete_cookie tool. It retrieves the WebDriver instance, instantiates CookieService, deletes the cookie by name, and returns a confirmation 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 schema defining the input parameter 'name' for the browser_delete_cookie tool.{ name: z.string().describe('Name of the cookie to delete'), },
- src/tools/cookieTools.ts:65-79 (registration)Registration of the browser_delete_cookie tool using server.tool, including description, schema, and 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)Supporting method in CookieService that performs the actual cookie deletion using Selenium WebDriver's deleteCookie.async deleteCookie(name: string): Promise<void> { await this.driver.manage().deleteCookie(name); }
- src/tools/index.ts:12-12 (registration)Invocation of registerCookieTools within the all-tools registration, which includes the browser_delete_cookie tool.registerCookieTools(server, stateManager);