Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: {},
      },
    },
  • 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);
      }
    }
  • 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;
      }
    }

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/markswendsen-code/mcp-instacart'

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