instacart_logout
Clear saved Instacart session and cookies to log out or reset authentication state for secure account management.
Instructions
Clear saved Instacart session and cookies. Use this to log out or reset authentication state.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:236-251 (handler)The main handler that executes the instacart_logout tool. It clears authentication data by calling clearAuthData() to remove cookies and session files, then closes the browser with closeBrowser(). Returns a success message confirming logout.
case "instacart_logout": { clearAuthData(); await closeBrowser(); return { content: [ { type: "text", text: JSON.stringify({ success: true, message: "Logged out. Session and cookies cleared.", }), }, ], }; } - src/index.ts:68-76 (registration)Tool registration in the ListToolsRequestSchema handler. Defines the tool name 'instacart_logout', its description for clearing saved session and cookies, and the input schema (empty object).
{ name: "instacart_logout", description: "Clear saved Instacart session and cookies. Use this to log out or reset authentication state.", inputSchema: { type: "object", properties: {}, }, }, - src/auth.ts:97-104 (helper)Helper function clearAuthData() that deletes the saved cookies.json and session.json files from the config directory (~/.strider/instacart/), effectively logging the user out by removing all persisted authentication data.
export function clearAuthData(): void { if (fs.existsSync(COOKIES_FILE)) { fs.unlinkSync(COOKIES_FILE); } if (fs.existsSync(SESSION_FILE)) { fs.unlinkSync(SESSION_FILE); } } - src/browser.ts:105-115 (helper)Helper function closeBrowser() that saves the current browser context cookies before closing, then closes the browser instance and resets the singleton variables (browser, context, page) to null.
export async function closeBrowser(): Promise<void> { if (context) { await saveCookies(context); } if (browser) { await browser.close(); browser = null; context = null; page = null; } }