jules_get_cookies
Extract current browser cookies to maintain session persistence and create backups for Google Jules AI coding assistant workflows.
Instructions
Extract current browser cookies for session persistence and backup
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Output format for cookies (default: json) |
Implementation Reference
- src/index.ts:1623-1656 (handler)The main handler function that extracts cookies from the browser context using Playwright's page.context().cookies() and returns them in JSON or string format.private async getCookies(args: any) { const { format = 'json' } = args; const page = await this.getPage(); try { const cookies = await page.context().cookies(); if (format === 'string') { const cookieString = cookies.map(cookie => `${cookie.name}=${cookie.value}; domain=${cookie.domain}; path=${cookie.path}` ).join('; '); return { content: [ { type: 'text', text: `Cookie String:\\n${cookieString}` } ] }; } else { return { content: [ { type: 'text', text: `Cookies (${cookies.length} total):\\n${JSON.stringify(cookies, null, 2)}` } ] }; } } catch (error) { throw new Error(`Failed to get cookies: ${error}`); } }
- src/index.ts:306-318 (schema)The tool schema definition including name, description, and input schema registered in the ListToolsRequestSchema handler.name: 'jules_get_cookies', description: 'Extract current browser cookies for session persistence and backup', inputSchema: { type: 'object', properties: { format: { type: 'string', enum: ['json', 'string'], description: 'Output format for cookies (default: json)', }, }, }, },
- src/index.ts:384-384 (registration)Registration of the tool handler in the CallToolRequestSchema switch statement, dispatching calls to the getCookies method.return await this.getCookies(args);