(input_json:str)
| 37 | return 'ERROR: timeout for 30s' |
| 38 | |
| 39 | def read_tool(input_json:str): |
| 40 | data = json.loads(input_json) |
| 41 | path = data.get('path', '') |
| 42 | try: |
| 43 | with open(path, 'r') as f: |
| 44 | content = f.read() |
| 45 | except FileNotFoundError: |
| 46 | return f'ERROR: file not found {path}' |
| 47 | return content |
| 48 | |
| 49 | def write_tool(input_json:str): |
| 50 | data = json.loads(input_json) |