get_authentication_info
Retrieve authentication state and token details to verify access status for Kroger's grocery shopping functionality via the MCP server.
Instructions
Get information about the current authentication state and token.
Returns:
Dictionary containing authentication information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function that implements the core logic of the get_authentication_info tool. It retrieves authentication details from the Kroger client, including token info (with previews for security), and handles errors.@mcp.tool() async def get_authentication_info(ctx: Context = None) -> Dict[str, Any]: """ Get information about the current authentication state and token. Returns: Dictionary containing authentication information """ if ctx: await ctx.info("Getting authentication information") try: client = get_authenticated_client() result = { "success": True, "authenticated": True, "message": "User is authenticated" } # Get token information if available if hasattr(client.client, 'token_info') and client.client.token_info: token_info = client.client.token_info result.update({ "token_type": token_info.get("token_type", "Unknown"), "has_refresh_token": "refresh_token" in token_info, "expires_in": token_info.get("expires_in"), "scope": token_info.get("scope", "Unknown") }) # Don't expose the actual tokens for security result["access_token_preview"] = f"{token_info.get('access_token', '')[:10]}..." if token_info.get('access_token') else "N/A" if "refresh_token" in token_info: result["refresh_token_preview"] = f"{token_info['refresh_token'][:10]}..." # Get token file information if available if hasattr(client.client, 'token_file') and client.client.token_file: result["token_file"] = client.client.token_file return result except Exception as e: if ctx: await ctx.error(f"Error getting authentication info: {str(e)}") return { "success": False, "error": str(e), "authenticated": False }
- src/kroger_mcp/server.py:76-76 (registration)Registers all tools from the profile_tools module, including get_authentication_info, with the FastMCP server instance.profile_tools.register_tools(mcp)