Skip to main content
Glama

browser_get_cookies

Retrieve all cookies from the current browser session to manage authentication states or track user data during web automation tasks.

Instructions

Get all cookies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Direct registration of the 'browser_get_cookies' tool using server.tool(), including the inline handler function that uses CookieService to fetch and return all cookie names.
    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(', ')}` }], }; });
  • Inline handler for 'browser_get_cookies' tool: retrieves Selenium driver, instantiates CookieService, gets all cookies, and formats response as text.
    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(', ')}` }], }; });
  • Core helper method getCookies() in CookieService class, which uses Selenium WebDriver to fetch all cookies and returns array of cookie names.
    async getCookies(): Promise<string[]> { const cookies = await this.driver.manage().getCookies(); return cookies.map(cookie => cookie.name); }

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