def uc_function_to_autogen_tool(
        *,
        function_name: str,
        client: Optional[BaseFunctionClient] = None,
        filter_accessible_functions: bool = False,
    ) -> Optional[UCFunctionTool]:
        """
        Converts a Unity Catalog function to a UCFunctionTool (Autogen v0.4+).

        Args:
            function_name: e.g. "catalog.schema.function".
            client: The client for managing functions.
        """
        client = validate_or_set_default_client(client)

        # Retrieve the FunctionInfo if only a name is provided
        if function_name is None:
            raise ValueError("function_name must be provided.")
        try:
            function_info = client.get_function(function_name)
        except PermissionError as e:
            _logger.info(f"Skipping {function_name} due to permission errors.")
            if filter_accessible_functions:
                return None
            raise e

        # Use your existing logic to build a dynamic Pydantic model for input parameters
        function_input_params_schema = generate_function_input_params_schema(
            function_info, strict=True
        )

        args_model = function_input_params_schema.pydantic_model

        # Build the UCFunctionTool
        tool_name = get_tool_name(function_name)  # short name for the LLM
        description = function_info.comment or ""

        return UCFunctionTool(
            name=tool_name,
            description=description,
            function_full_name=function_name,
            client=client,
            args_type=args_model,
        )

        Converts a Unity Catalog function to a UCFunctionTool (Autogen v0.4+).

        Args:
            function_name: e.g. "catalog.schema.function".
            client: The client for managing functions.
        
ai/integrations/autogen/src/unitycatalog/ai/autogen/toolkit.py