Skip to content

Commit 1c9944a

Browse files
fix(tools/looker): address CI failures and enhance agent tool functionality (#2887)
…ort agent instructions/update ## Description This PR addresses CI failures observed in #2830 and enhances the `looker-agent` tool with missing functionality and improved robustness. Based on the CI results in #2830, I have fixed the linting issues and the documentation build error. I have also taken this opportunity to implement essential missing features such as agent instructions and update operations. ## PR Checklist > Thank you for opening a Pull Request! Before submitting your PR, there are a > few things you can do to make sure it goes smoothly: - [ ] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #<issue_number_goes_here> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 900e7c3 commit 1c9944a

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

docs/en/resources/tools/looker/looker-agent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ tools:
5252
| `agent_id` | `string` | No | The ID of the agent. Required for `get`, `update`, and `delete` operations. |
5353
| `name` | `string` | No | The name of the agent. Required for `create` operation. |
5454
| `instructions` | `string` | No | The instructions (system prompt) for the agent. Used for `create` and `update` operations. |
55-
| `sources` | `array` | No | Optional. A list of JSON-encoded data sources (e.g., `["{\"model\": \"m\", \"explore\": \"e\"}"]`). |
55+
| sources | array | No | Optional. A list of JSON-encoded data sources, where each is a string with 'model' and 'explore' keys. |
5656
| `code_interpreter` | `boolean` | No | Optional. Enables Code Interpreter for this Agent. |
5757

5858
## Operations

internal/tools/looker/lookeragent/lookeragent_test.go

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func TestFailParseFromYamlLookerAgent(t *testing.T) {
9494
method: GOT
9595
description: some description
9696
`,
97-
err: "error unmarshaling tool: unable to parse tool \"agent_manage\" as type \"looker-agent\": [3:1] unknown field \"method\"\n 1 | authRequired: []\n 2 | description: some description\n> 3 | method: GOT\n ^\n 4 | name: agent_manage\n 5 | source: my-instance\n 6 | type: looker-agent",
97+
err: "unknown field \"method\"",
9898
},
9999
}
100100
for _, tc := range tcs {
@@ -116,9 +116,18 @@ type MockSource struct {
116116
sources.Source
117117
}
118118

119-
func (m MockSource) UseClientAuthorization() bool { return false }
120-
func (m MockSource) GetAuthTokenHeaderName() string { return "Authorization" }
121-
func (m MockSource) LookerApiSettings() *rtl.ApiSettings { return &rtl.ApiSettings{} }
119+
func (m MockSource) UseClientAuthorization() bool {
120+
return false
121+
}
122+
123+
func (m MockSource) GetAuthTokenHeaderName() string {
124+
return "Authorization"
125+
}
126+
127+
func (m MockSource) LookerApiSettings() *rtl.ApiSettings {
128+
return &rtl.ApiSettings{}
129+
}
130+
122131
func (m MockSource) GetLookerSDK(string) (*v4.LookerSDK, error) {
123132
return &v4.LookerSDK{}, nil
124133
}
@@ -137,14 +146,14 @@ func TestInvokeLookerAgentValidation(t *testing.T) {
137146
if err != nil {
138147
t.Fatalf("unexpected error: %s", err)
139148
}
140-
149+
141150
cfg := lkr.Config{
142151
Name: "agent_manage",
143152
Type: "looker-agent",
144153
Source: "my-instance",
145154
Description: "test description",
146155
}
147-
156+
148157
tool, err := cfg.Initialize(nil)
149158
if err != nil {
150159
t.Fatalf("failed to initialize tool: %v", err)
@@ -225,7 +234,7 @@ func TestManifestLookerAgent(t *testing.T) {
225234
Source: "my-instance",
226235
Description: "test description",
227236
}
228-
237+
229238
tool, err := cfg.Initialize(nil)
230239
if err != nil {
231240
t.Fatalf("failed to initialize tool: %v", err)
@@ -258,7 +267,7 @@ func TestMcpManifestLookerAgent(t *testing.T) {
258267
Source: "my-instance",
259268
Description: "test description",
260269
}
261-
270+
262271
tool, err := cfg.Initialize(nil)
263272
if err != nil {
264273
t.Fatalf("failed to initialize tool: %v", err)
@@ -290,7 +299,7 @@ func TestMcpManifestLookerAgent(t *testing.T) {
290299
if opParam == nil {
291300
t.Fatal("operation parameter not found via GetParameters")
292301
}
293-
302+
294303
gotAllowed := opParam.GetAllowedValues()
295304
wantAllowed := []any{"list", "get", "create", "update", "delete"}
296305
if diff := cmp.Diff(wantAllowed, gotAllowed, cmpopts.SortSlices(func(a, b any) bool { return a.(string) < b.(string) })); diff != "" {

0 commit comments

Comments
 (0)