force_reauthenticate
Clear the current authentication token to resolve login issues or switch users on the Kroger MCP Server. Initiates re-authentication for seamless access to grocery shopping functionalities.
Instructions
Force re-authentication by clearing the current authentication token.
Use this if you're having authentication issues or need to log in as a different user.
Returns:
Dictionary indicating the re-authentication was initiated
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The force_reauthenticate tool handler. Clears the global authenticated client using invalidate_authenticated_client() and informs the user.async def force_reauthenticate(ctx: Context = None) -> Dict[str, Any]: """ Force re-authentication by clearing the current authentication token. Use this if you're having authentication issues or need to log in as a different user. Returns: Dictionary indicating the re-authentication was initiated """ if ctx: await ctx.info("Forcing re-authentication by clearing current token") try: # Clear the current authenticated client invalidate_authenticated_client() if ctx: await ctx.info("Authentication token cleared. Next cart operation will trigger re-authentication.") return { "success": True, "message": "Authentication token cleared. The next cart operation will open your browser for re-authentication.", "note": "You will need to log in again when you next use cart-related tools." } except Exception as e: if ctx: await ctx.error(f"Error clearing authentication: {str(e)}") return { "success": False, "error": str(e) }
- Core helper function that invalidates the global _authenticated_client variable, forcing re-authentication on next use.def invalidate_authenticated_client(): """Invalidate the authenticated client to force re-authentication""" global _authenticated_client _authenticated_client = None
- src/kroger_mcp/server.py:76-76 (registration)Registration of profile tools, including force_reauthenticate, via the module's register_tools function.profile_tools.register_tools(mcp)