(ctx context.Context, input string)
| 52 | } |
| 53 | |
| 54 | func (t Tool) Call(ctx context.Context, input string) (string, error) { |
| 55 | if t.CallbacksHandler != nil { |
| 56 | t.CallbacksHandler.HandleToolStart(ctx, input) |
| 57 | } |
| 58 | |
| 59 | result, err := t.client.Search(ctx, input) |
| 60 | if err != nil { |
| 61 | if errors.Is(err, internal.ErrNoGoodResult) { |
| 62 | return "No good Google Search Results was found", nil |
| 63 | } |
| 64 | |
| 65 | if t.CallbacksHandler != nil { |
| 66 | t.CallbacksHandler.HandleToolError(ctx, err) |
| 67 | } |
| 68 | |
| 69 | return "", err |
| 70 | } |
| 71 | |
| 72 | if t.CallbacksHandler != nil { |
| 73 | t.CallbacksHandler.HandleToolEnd(ctx, result) |
| 74 | } |
| 75 | |
| 76 | return strings.Join(strings.Fields(result), " "), nil |
| 77 | } |
nothing calls this directly
no test coverage detected