Skip to main content
Glama

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

NameRequiredDescriptionDefault
nameYesName 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

  • 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}` }], }; }
  • Zod schema defining the input parameter 'name' for the browser_delete_cookie tool.
    { name: z.string().describe('Name of the cookie to delete'), },
  • 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}` }], }; } );
  • 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); }
  • Invocation of registerCookieTools within the all-tools registration, which includes the browser_delete_cookie tool.
    registerCookieTools(server, stateManager);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pshivapr/selenium-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server