def _register_tools(self):
        """
        Register all requested tools from self.config.rag_tools using the ToolRegistry.
        """
        if not self.config.rag_tools:
            logger.warning(
                "No RAG tools requested. Skipping tool registration."
            )
            return

        # Make sure tool_registry exists
        if not hasattr(self, "tool_registry") or self.tool_registry is None:
            self.tool_registry = ToolRegistry()

        format_function = self.format_search_results_for_llm

        for tool_name in set(self.config.rag_tools):
            # Try to get the tools from the registry
            if tool_instance := self.tool_registry.create_tool_instance(
                tool_name, format_function, context=self
            ):
                logger.debug(
                    f"Successfully registered tool from registry: {tool_name}"
                )
                self._tools.append(tool_instance)
            else:
                logger.warning(f"Unknown tool requested: {tool_name}")

        logger.debug(f"Registered {len(self._tools)} RAG tools.")

        Register all requested tools from self.config.rag_tools using the ToolRegistry.
        
py/core/agent/rag.py