Skip to main content
Glama

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
NameRequiredDescriptionDefault
nameYesName of the cookie to delete

Implementation Reference

  • 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}` }],
      };
    }
  • Zod input schema defining the 'name' parameter for the 'browser_delete_cookie' tool.
    {
      name: z.string().describe('Name of the cookie to delete'),
    },
  • 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}` }],
        };
      }
    );
  • 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);
    }
  • Higher-level registration call for all cookie tools, including 'browser_delete_cookie', within registerAllTools.
    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