superset_auth_check_token_validity
Verify authentication status by checking if the current access token is valid before making API calls to Apache Superset instances.
Instructions
Check if the current access token is still valid
Makes a request to the /api/v1/me/ endpoint to test if the current token is valid. Use this to verify authentication status before making other API calls.
Returns: A dictionary with token validity status and any error information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.py:335-366 (handler)The main handler function for the 'superset_auth_check_token_validity' tool. It checks the validity of the current Superset access token by making a GET request to the /api/v1/me/ endpoint. Returns whether the token is valid or provides error details if invalid or no token exists. Decorated with @mcp.tool() for registration and @handle_api_errors for error handling.@mcp.tool() @handle_api_errors async def superset_auth_check_token_validity(ctx: Context) -> Dict[str, Any]: """ Check if the current access token is still valid Makes a request to the /api/v1/me/ endpoint to test if the current token is valid. Use this to verify authentication status before making other API calls. Returns: A dictionary with token validity status and any error information """ superset_ctx: SupersetContext = ctx.request_context.lifespan_context if not superset_ctx.access_token: return {"valid": False, "error": "No access token available"} try: # Make a simple API call to test if token is valid (get user info) response = await superset_ctx.client.get("/api/v1/me/") if response.status_code == 200: return {"valid": True} else: return { "valid": False, "status_code": response.status_code, "error": response.text, } except Exception as e: return {"valid": False, "error": str(e)}