(input_json:str)
| 47 | return content |
| 48 | |
| 49 | def write_tool(input_json:str): |
| 50 | data = json.loads(input_json) |
| 51 | path = data.get('path', '') |
| 52 | content = data.get('content', '') |
| 53 | try: |
| 54 | with open(path, 'w') as f: |
| 55 | f.write(content) |
| 56 | except FileNotFoundError: |
| 57 | return f'ERROR: directory not found {path}' |
| 58 | return f'OK: wrote to {path}' |