call_auth_admin_method
Authenticate and manage Supabase users securely by calling Auth Admin methods. Perform tasks like creating, updating, deleting users, generating links, and managing multi-factor authentication. Inputs are validated for safety.
Instructions
Call an Auth Admin method from Supabase Python SDK.
This tool provides a safe, validated interface to the Supabase Auth Admin SDK, allowing you to:
Manage users (create, update, delete)
List and search users
Generate authentication links
Manage multi-factor authentication
And more
IMPORTANT NOTES:
Request bodies must adhere to the Python SDK specification
Some methods may have nested parameter structures
The tool validates all parameters against Pydantic models
Extra fields not defined in the models will be rejected
AVAILABLE METHODS:
get_user_by_id: Retrieve a user by their ID
list_users: List all users with pagination
create_user: Create a new user
delete_user: Delete a user by their ID
invite_user_by_email: Send an invite link to a user's email
generate_link: Generate an email link for various authentication purposes
update_user_by_id: Update user attributes by ID
delete_factor: Delete a factor on a user
EXAMPLES:
Get user by ID: method: "get_user_by_id" params: {"uid": "user-uuid-here"}
Create user: method: "create_user" params: { "email": "user@example.com", "password": "secure-password" }
Update user by ID: method: "update_user_by_id" params: { "uid": "user-uuid-here", "attributes": { "email": "new@email.com" } }
For complete documentation of all methods and their parameters, use the get_auth_admin_methods_spec tool.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| method | Yes | ||
| params | Yes |
Implementation Reference
- supabase_mcp/tools/registry.py:129-134 (handler)MCP tool handler for 'call_auth_admin_method', decorated with @mcp.tool and registers the tool. Delegates to feature_manager.execute_tool.@mcp.tool(description=tool_manager.get_description(ToolName.CALL_AUTH_ADMIN_METHOD)) # type: ignore async def call_auth_admin_method(method: str, params: dict[str, Any]) -> dict[str, Any]: """Call an Auth Admin method from Supabase Python SDK.""" return await feature_manager.execute_tool( ToolName.CALL_AUTH_ADMIN_METHOD, services_container=services_container, method=method, params=params )
- Intermediate wrapper in feature_manager that invokes the sdk_client's call_auth_admin_method after feature access check (via execute_tool).async def call_auth_admin_method( self, container: "ServicesContainer", method: str, params: dict[str, Any] ) -> dict[str, Any]: """Call an Auth Admin method from Supabase Python SDK.""" sdk_client = container.sdk_client return await sdk_client.call_auth_admin_method(method, params)
- Core implementation of call_auth_admin_method: validates input params using Pydantic models (PARAM_MODELS), checks service role key, dispatches to specific handlers (_get_user_by_id, _create_user, etc.) that invoke the Supabase Python SDK auth.admin methods.async def call_auth_admin_method(self, method: str, params: dict[str, Any]) -> Any: """Calls a method of the Python SDK client""" # Check if service role key is available if not self.service_role_key: raise PythonSDKError( "Supabase service role key is not configured. Set SUPABASE_SERVICE_ROLE_KEY environment variable to use Auth Admin tools." ) if not self.client: self.client = await self.get_client() if not self.client: raise PythonSDKError("Python SDK client not initialized") # Validate method exists if method not in PARAM_MODELS: available_methods = ", ".join(PARAM_MODELS.keys()) raise PythonSDKError(f"Unknown method: {method}. Available methods: {available_methods}") # Get the appropriate model class and validate parameters param_model_cls = PARAM_MODELS[method] validated_params = self._validate_params(method, params, param_model_cls) # Method dispatch using a dictionary of method implementations method_handlers = { "get_user_by_id": self._get_user_by_id, "list_users": self._list_users, "create_user": self._create_user, "delete_user": self._delete_user, "invite_user_by_email": self._invite_user_by_email, "generate_link": self._generate_link, "update_user_by_id": self._update_user_by_id, "delete_factor": self._delete_factor, } # Call the appropriate method handler try: handler = method_handlers.get(method) if not handler: raise PythonSDKError(f"Method {method} is not implemented") logger.debug(f"Python SDK request params: {validated_params}") return await handler(validated_params) except Exception as e: if isinstance(e, IncorrectSDKParamsError): # Re-raise our custom error without wrapping it raise e logger.error(f"Error calling {method}: {e}") raise PythonSDKError(f"Error calling {method}: {str(e)}") from e
- supabase_mcp/tools/manager.py:31-31 (registration)ToolName enum definition for CALL_AUTH_ADMIN_METHOD, used in registration and dispatching.CALL_AUTH_ADMIN_METHOD = "call_auth_admin_method"