get_authentication_info
Retrieve authentication status and token details for accessing Kroger's grocery shopping features through 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 main execution logic for the 'get_authentication_info' tool. This async function retrieves the authenticated Kroger client, extracts token information (type, expiration, scope, previews without full tokens for security), token file path, and returns a structured dictionary with authentication status.@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)Invocation of profile_tools.register_tools(mcp) in the server creation function, which defines and registers the get_authentication_info tool (along with other profile tools) by applying the @mcp.tool() decorator.profile_tools.register_tools(mcp)
- src/kroger_mcp/server.py:27-27 (registration)Import of the profile_tools module containing the get_authentication_info tool definition and registration logic.from .tools import profile_tools