| from langchain.tools import tool | |
| def read_file_tool(file_path: str) -> str: | |
| """ | |
| Tool to read a file and return its content. | |
| Args: | |
| file_path (str): Path to the file to read. | |
| Returns: | |
| str: Content of the file or error message. | |
| """ | |
| try: | |
| with open(file_path, "r") as file: | |
| return file.read() | |
| except Exception as e: | |
| return f"Error reading file: {str(e)}" |