(_ context.Context, rawInput string)
| 32 | } |
| 33 | |
| 34 | func (WriteFileTool) Execute(_ context.Context, rawInput string) (string, bool) { |
| 35 | var in struct { |
| 36 | Path string `json:"path"` |
| 37 | Content string `json:"content"` |
| 38 | } |
| 39 | if err := json.Unmarshal([]byte(rawInput), &in); err != nil { |
| 40 | return fmt.Sprintf("invalid tool input: %v", err), true |
| 41 | } |
| 42 | if err := os.WriteFile(in.Path, []byte(in.Content), 0644); err != nil { |
| 43 | return err.Error(), true |
| 44 | } |
| 45 | return fmt.Sprintf("wrote %d bytes to %s", len(in.Content), in.Path), false |
| 46 | } |
nothing calls this directly
no outgoing calls
no test coverage detected