validate_auth
Check API credentials to verify authentication status for secure access to Frappe Framework sites.
Instructions
Validate API credentials and return authentication status.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/helpers.py:27-30 (handler)The handler function for the 'validate_auth' tool. It is decorated with @mcp.tool() and simply returns the result of validate_api_credentials().@mcp.tool() def validate_auth() -> Dict[str, Any]: """Validate API credentials and return authentication status.""" return validate_api_credentials()
- src/server.py:38-42 (registration)The registration point where helpers.register_tools(mcp) is called, which defines and registers the validate_auth tool along with other helpers.# Register all tool modules helpers.register_tools(mcp) documents.register_tools(mcp) schema.register_tools(mcp) reports.register_tools(mcp)
- src/auth.py:12-61 (helper)Core helper function validate_api_credentials() that checks environment variables for FRAPPE_API_KEY and FRAPPE_API_SECRET and returns authentication status. This is called directly by the validate_auth handler.def validate_api_credentials() -> Dict[str, Any]: """ Validate that required API credentials are available. Returns: Dict containing validation status and details """ api_key = os.getenv("FRAPPE_API_KEY") api_secret = os.getenv("FRAPPE_API_SECRET") if not api_key and not api_secret: return { "valid": False, "message": "Both API key and API secret are missing", "details": { "api_key_available": False, "api_secret_available": False, "auth_method": "API key/secret (token)" } } elif not api_key: return { "valid": False, "message": "API key is missing", "details": { "api_key_available": False, "api_secret_available": True, "auth_method": "API key/secret (token)" } } elif not api_secret: return { "valid": False, "message": "API secret is missing", "details": { "api_key_available": True, "api_secret_available": False, "auth_method": "API key/secret (token)" } } return { "valid": True, "message": "API credentials are properly configured", "details": { "api_key_available": True, "api_secret_available": True, "auth_method": "API key/secret (token)" } }