Skip to content

Commit df7f2fd

Browse files
fix(sources/looker): looker and looker-dev prebuilt tools should share one source definition. (#2620)
## Description Share the source definition between looker and looker-dev prebuilt tools. ## 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: - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md) - [x] 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 - [x] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) - [x] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #2615
1 parent b5c866c commit df7f2fd

4 files changed

Lines changed: 31 additions & 27 deletions

File tree

cmd/internal/tools_file.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"strings"
2727

2828
"github.com/goccy/go-yaml"
29+
"github.com/google/go-cmp/cmp"
2930
"github.com/googleapis/genai-toolbox/internal/server"
3031
)
3132

@@ -236,8 +237,10 @@ func mergeToolsFiles(files ...ToolsFile) (ToolsFile, error) {
236237
for fileIndex, file := range files {
237238
// Check for conflicts and merge sources
238239
for name, source := range file.Sources {
239-
if _, exists := merged.Sources[name]; exists {
240-
conflicts = append(conflicts, fmt.Sprintf("source '%s' (file #%d)", name, fileIndex+1))
240+
if mergedSource, exists := merged.Sources[name]; exists {
241+
if !cmp.Equal(mergedSource, source) {
242+
conflicts = append(conflicts, fmt.Sprintf("source '%s' (file #%d)", name, fileIndex+1))
243+
}
241244
} else {
242245
merged.Sources[name] = source
243246
}

docs/LOOKER_README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ An editor configured to use the Looker MCP server can use its AI capabilities to
2727
> `>=0.26.0`. To update MCP Toolbox, use:
2828
> ```npm i -g @toolbox-sdk/server@latest```
2929
> To always run the latest version, update the MCP server configuration to use:
30-
> ```npx -y @toolbox-sdk/server@latest --prebuilt looker```.
30+
> ```npx -y @toolbox-sdk/server@latest --prebuilt looker,looker-dev```.
3131
3232
2. Add the required inputs for your [instance](https://docs.cloud.google.com/looker/docs/set-up-and-administer-looker) in the configuration pop-up, then click "Save". You can update this configuration at any time in the "Configure" tab.
3333

@@ -83,7 +83,7 @@ Add the following configuration to your MCP client (e.g., `settings.json` for Ge
8383
"mcpServers": {
8484
"looker": {
8585
"command": "npx",
86-
"args": ["-y", "@toolbox-sdk/server", "--prebuilt", "looker", "--stdio"],
86+
"args": ["-y", "@toolbox-sdk/server", "--prebuilt", "looker,looker-dev", "--stdio"],
8787
"env": {
8888
"LOOKER_BASE_URL": "https://your.looker.instance.com",
8989
"LOOKER_CLIENT_ID": "your-client-id",

docs/en/reference/prebuilt-tools.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ See [Usage Examples](../reference/cli.md#examples).
551551
## Looker Dev
552552

553553
* `--prebuilt` value: `looker-dev`
554+
* May be used in combination with Looker, `--prebuilt looker,looker-dev`
554555
* **Environment Variables:**
555556
* `LOOKER_BASE_URL`: The URL of your Looker instance.
556557
* `LOOKER_CLIENT_ID`: The client ID for the Looker API.

internal/prebuiltconfigs/tools/looker-dev.yaml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
sources:
16-
looker-dev-source:
16+
looker-source:
1717
kind: looker
1818
base_url: ${LOOKER_BASE_URL}
1919
client_id: ${LOOKER_CLIENT_ID:}
@@ -28,7 +28,7 @@ sources:
2828
tools:
2929
health_pulse:
3030
kind: looker-health-pulse
31-
source: looker-dev-source
31+
source: looker-source
3232
description: |
3333
This tool performs various health checks on a Looker instance.
3434
@@ -49,7 +49,7 @@ tools:
4949
5050
health_analyze:
5151
kind: looker-health-analyze
52-
source: looker-dev-source
52+
source: looker-source
5353
description: |
5454
This tool calculates the usage statistics for Looker projects, models, and explores.
5555
@@ -66,7 +66,7 @@ tools:
6666
6767
health_vacuum:
6868
kind: looker-health-vacuum
69-
source: looker-dev-source
69+
source: looker-source
7070
description: |
7171
This tool identifies and suggests LookML models or explores that can be
7272
safely removed due to inactivity or low usage.
@@ -84,7 +84,7 @@ tools:
8484
8585
dev_mode:
8686
kind: looker-dev-mode
87-
source: looker-dev-source
87+
source: looker-source
8888
description: |
8989
This tool allows toggling the Looker IDE session between Development Mode and Production Mode.
9090
Development Mode enables making and testing changes to LookML projects.
@@ -96,7 +96,7 @@ tools:
9696
9797
get_projects:
9898
kind: looker-get-projects
99-
source: looker-dev-source
99+
source: looker-source
100100
description: |
101101
This tool retrieves a list of all LookML projects available on the Looker instance.
102102
It is useful for identifying projects before performing actions like retrieving
@@ -111,7 +111,7 @@ tools:
111111
112112
get_project_files:
113113
kind: looker-get-project-files
114-
source: looker-dev-source
114+
source: looker-source
115115
description: |
116116
This tool retrieves a list of all LookML files within a specified project,
117117
providing details about each file.
@@ -125,7 +125,7 @@ tools:
125125
126126
get_project_file:
127127
kind: looker-get-project-file
128-
source: looker-dev-source
128+
source: looker-source
129129
description: |
130130
This tool retrieves the raw content of a specific LookML file from within a project.
131131
@@ -139,7 +139,7 @@ tools:
139139
140140
create_project_file:
141141
kind: looker-create-project-file
142-
source: looker-dev-source
142+
source: looker-source
143143
description: |
144144
This tool creates a new LookML file within a specified project, populating
145145
it with the provided content.
@@ -156,7 +156,7 @@ tools:
156156
157157
update_project_file:
158158
kind: looker-update-project-file
159-
source: looker-dev-source
159+
source: looker-source
160160
description: |
161161
This tool modifies the content of an existing LookML file within a specified project.
162162
@@ -172,7 +172,7 @@ tools:
172172
173173
delete_project_file:
174174
kind: looker-delete-project-file
175-
source: looker-dev-source
175+
source: looker-source
176176
description: |
177177
This tool permanently deletes a specified LookML file from within a project.
178178
Use with caution, as this action cannot be undone through the API.
@@ -188,7 +188,7 @@ tools:
188188
189189
get_project_directories:
190190
kind: looker-get-project-directories
191-
source: looker-dev-source
191+
source: looker-source
192192
description: |
193193
This tool retrieves the list of directories within a specified LookML project.
194194
@@ -200,7 +200,7 @@ tools:
200200
201201
create_project_directory:
202202
kind: looker-create-project-directory
203-
source: looker-dev-source
203+
source: looker-source
204204
description: |
205205
This tool creates a new directory within a specified LookML project.
206206
@@ -215,7 +215,7 @@ tools:
215215
216216
delete_project_directory:
217217
kind: looker-delete-project-directory
218-
source: looker-dev-source
218+
source: looker-source
219219
description: |
220220
This tool permanently deletes a specified directory within a LookML project.
221221
@@ -230,7 +230,7 @@ tools:
230230
231231
validate_project:
232232
kind: looker-validate-project
233-
source: looker-dev-source
233+
source: looker-source
234234
description: |
235235
This tool checks a LookML project for syntax errors.
236236
@@ -245,7 +245,7 @@ tools:
245245
246246
get_connections:
247247
kind: looker-get-connections
248-
source: looker-dev-source
248+
source: looker-source
249249
description: |
250250
This tool retrieves a list of all database connections configured in the Looker system.
251251
@@ -262,7 +262,7 @@ tools:
262262
263263
get_connection_schemas:
264264
kind: looker-get-connection-schemas
265-
source: looker-dev-source
265+
source: looker-source
266266
description: |
267267
This tool retrieves a list of database schemas available through a specified
268268
Looker connection.
@@ -277,7 +277,7 @@ tools:
277277
278278
get_connection_databases:
279279
kind: looker-get-connection-databases
280-
source: looker-dev-source
280+
source: looker-source
281281
description: |
282282
This tool retrieves a list of databases available through a specified Looker connection.
283283
This is only applicable for connections that support multiple databases.
@@ -292,7 +292,7 @@ tools:
292292
293293
get_connection_tables:
294294
kind: looker-get-connection-tables
295-
source: looker-dev-source
295+
source: looker-source
296296
description: |
297297
This tool retrieves a list of tables available within a specified database schema
298298
through a Looker connection.
@@ -308,7 +308,7 @@ tools:
308308
309309
get_connection_table_columns:
310310
kind: looker-get-connection-table-columns
311-
source: looker-dev-source
311+
source: looker-source
312312
description: |
313313
This tool retrieves a list of columns for one or more specified tables within a
314314
given database schema and connection.
@@ -327,7 +327,7 @@ tools:
327327
328328
get_lookml_tests:
329329
kind: looker-get-lookml-tests
330-
source: looker-dev-source
330+
source: looker-source
331331
description: |
332332
Returns a list of tests which can be run to validate a project's LookML code and/or the underlying data, optionally filtered by the file id.
333333
@@ -348,7 +348,7 @@ tools:
348348
349349
run_lookml_tests:
350350
kind: looker-run-lookml-tests
351-
source: looker-dev-source
351+
source: looker-source
352352
description: |
353353
This tool runs LookML tests in the project, filtered by file, test, and/or model. These filters work in conjunction (logical AND).
354354
@@ -372,7 +372,7 @@ tools:
372372
373373
create_view_from_table:
374374
kind: looker-create-view-from-table
375-
source: looker-dev-source
375+
source: looker-source
376376
description: |
377377
This tool generates boilerplate LookML views directly from the database schema.
378378
It does not create model or explore files, only view files in the specified folder.

0 commit comments

Comments
 (0)