Skip to content

Commit 5508755

Browse files
fix(tools/looker): refactor looker-git-branch tool into 5 separate tools with proper annotations to isolate readonly and destructive tool actions
1 parent 649d4ad commit 5508755

File tree

23 files changed

+1439
-199
lines changed

23 files changed

+1439
-199
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ __pycache__/
2626
genai-toolbox
2727
toolbox
2828
toolbox.exe
29+
**/test.db

cmd/internal/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ func TestPrebuiltTools(t *testing.T) {
18661866
wantToolset: server.ToolsetConfigs{
18671867
"looker_dev_tools": tools.ToolsetConfig{
18681868
Name: "looker_dev_tools",
1869-
ToolNames: []string{"health_pulse", "health_analyze", "health_vacuum", "dev_mode", "get_projects", "get_project_files", "get_project_file", "create_project_file", "update_project_file", "delete_project_file", "get_project_directories", "create_project_directory", "delete_project_directory", "validate_project", "get_connections", "get_connection_schemas", "get_connection_databases", "get_connection_tables", "get_connection_table_columns", "get_lookml_tests", "run_lookml_tests", "create_view_from_table", "project_git_branch"},
1869+
ToolNames: []string{"health_pulse", "health_analyze", "health_vacuum", "dev_mode", "get_projects", "get_project_files", "get_project_file", "create_project_file", "update_project_file", "delete_project_file", "get_project_directories", "create_project_directory", "delete_project_directory", "validate_project", "get_connections", "get_connection_schemas", "get_connection_databases", "get_connection_tables", "get_connection_table_columns", "get_lookml_tests", "run_lookml_tests", "create_view_from_table", "list_git_branches", "get_git_branch", "create_git_branch", "switch_git_branch", "delete_git_branch"},
18701870
},
18711871
},
18721872
},

cmd/internal/imports.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,12 @@ import (
114114
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookeradddashboardfilter"
115115
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerconversationalanalytics"
116116
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookercreateagent"
117+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookercreategitbranch"
117118
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookercreateprojectdirectory"
118119
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookercreateprojectfile"
119120
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookercreateviewfromtable"
120121
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerdeleteagent"
122+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerdeletegitbranch"
121123
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerdeleteprojectdirectory"
122124
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerdeleteprojectfile"
123125
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerdevmode"
@@ -132,6 +134,7 @@ import (
132134
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetdimensions"
133135
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetexplores"
134136
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetfilters"
137+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetgitbranch"
135138
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetlookmltests"
136139
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetlooks"
137140
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetmeasures"
@@ -141,11 +144,11 @@ import (
141144
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetprojectfile"
142145
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetprojectfiles"
143146
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetprojects"
144-
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergitbranch"
145147
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerhealthanalyze"
146148
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerhealthpulse"
147149
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerhealthvacuum"
148150
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerlistagents"
151+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerlistgitbranches"
149152
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookermakedashboard"
150153
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookermakelook"
151154
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerquery"
@@ -154,6 +157,7 @@ import (
154157
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerrundashboard"
155158
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerrunlook"
156159
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerrunlookmltests"
160+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerswitchgitbranch"
157161
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerupdateagent"
158162
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerupdateprojectfile"
159163
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookervalidateproject"

docs/en/documentation/connect-to/ides/looker_mcp.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,11 @@ as well as get the database schema needed to write LookML effectively.
551551
1. **get_lookml_tests**: Retrieves a list of available LookML tests for a project.
552552
1. **run_lookml_tests**: Executes specific LookML tests within a project.
553553
1. **create_view_from_table**: Generates boilerplate LookML views directly from the database schema.
554-
1. **project_git_branch**: Fetch and manipulate the git branch of a LookML project.
554+
1. **list_git_branches**: List the available git branches of a LookML project.
555+
1. **get_git_branch**: Get the current git branch of a LookML project.
556+
1. **create_git_branch**: Create a new git branch for a LookML project.
557+
1. **switch_git_branch**: Switch the git branch of a LookML project.
558+
1. **delete_git_branch**: Delete a git branch of a LookML project.
555559
556560
{{< notice note >}}
557561
Prebuilt tools are pre-1.0, so expect some tool changes between versions. LLMs

docs/en/integrations/looker/prebuilt-configs/looker-dev.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ description: "Details of the Looker Dev prebuilt configuration."
4343
* `get_lookml_tests`: Retrieves a list of available LookML tests for a project.
4444
* `run_lookml_tests`: Executes specific LookML tests within a project.
4545
* `create_view_from_table`: Generates boilerplate LookML views directly from the database schema.
46-
* `project_git_branch`: Fetch and manipulate the git branch of a LookML project.
46+
* `list_git_branches`: List the available git branches of a LookML project.
47+
* `get_git_branch`: Get the current git branch of a LookML project.
48+
* `create_git_branch`: Create a new git branch for a LookML project.
49+
* `switch_git_branch`: Switch the git branch of a LookML project.
50+
* `delete_git_branch`: Delete a git branch of a LookML project.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "Create Git Branch Tool"
3+
type: docs
4+
weight: 1
5+
description: >
6+
A "looker-create-git-branch" tool is used to create a new git branch for a LookML project.
7+
---
8+
9+
## About
10+
11+
A `looker-create-git-branch` tool is used to create a new git branch
12+
for a LookML project.
13+
14+
## Compatible Sources
15+
16+
{{< compatible-sources >}}
17+
18+
## Parameters
19+
20+
| **field** | **type** | **required** | **description** |
21+
| ---------- | :------: | :----------: | ----------------------------------------- |
22+
| project_id | string | true | The unique ID of the LookML project. |
23+
| branch | string | true | The git branch to create. |
24+
| ref | string | false | The ref to use as the start of a new branch. Defaults to HEAD of current branch. |
25+
26+
## Example
27+
28+
```yaml
29+
kind: tool
30+
name: create_project_git_branch
31+
type: looker-create-git-branch
32+
source: looker-source
33+
description: |
34+
This tool is used to create a new git branch of a LookML
35+
project. This only works in dev mode.
36+
```
37+
38+
## Reference
39+
40+
| **field** | **type** | **required** | **description** |
41+
|-------------|:--------:|:------------:|----------------------------------------------------|
42+
| type | string | true | Must be "looker-create-git-branch". |
43+
| source | string | true | Name of the source. |
44+
| description | string | true | Description of the tool that is passed to the LLM. |
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: "Delete Git Branch Tool"
3+
type: docs
4+
weight: 1
5+
description: >
6+
A "looker-delete-git-branch" tool is used to delete a git branch of a LookML project.
7+
---
8+
9+
## About
10+
11+
A `looker-delete-git-branch` tool is used to delete a git branch
12+
of a LookML project.
13+
14+
## Compatible Sources
15+
16+
{{< compatible-sources >}}
17+
18+
## Parameters
19+
20+
| **field** | **type** | **required** | **description** |
21+
| ---------- | :------: | :----------: | ----------------------------------------- |
22+
| project_id | string | true | The unique ID of the LookML project. |
23+
| branch | string | true | The git branch to delete. |
24+
25+
## Example
26+
27+
```yaml
28+
kind: tool
29+
name: delete_project_git_branch
30+
type: looker-delete-git-branch
31+
source: looker-source
32+
description: |
33+
This tool is used to delete a git branch of a LookML
34+
project. This only works in dev mode.
35+
```
36+
37+
## Reference
38+
39+
| **field** | **type** | **required** | **description** |
40+
|-------------|:--------:|:------------:|----------------------------------------------------|
41+
| type | string | true | Must be "looker-delete-git-branch". |
42+
| source | string | true | Name of the source. |
43+
| description | string | true | Description of the tool that is passed to the LLM. |
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: "Get Git Branch Tool"
3+
type: docs
4+
weight: 1
5+
description: >
6+
A "looker-get-git-branch" tool is used to retrieve the current git branch of a LookML project.
7+
---
8+
9+
## About
10+
11+
A `looker-get-git-branch` tool is used to retrieve the current git branch
12+
of a LookML project.
13+
14+
## Compatible Sources
15+
16+
{{< compatible-sources >}}
17+
18+
## Parameters
19+
20+
| **field** | **type** | **required** | **description** |
21+
| ---------- | :------: | :----------: | ----------------------------------------- |
22+
| project_id | string | true | The unique ID of the LookML project. |
23+
24+
## Example
25+
26+
```yaml
27+
kind: tool
28+
name: get_project_git_branch
29+
type: looker-get-git-branch
30+
source: looker-source
31+
description: |
32+
This tool is used to retrieve the current git branch of a LookML
33+
project.
34+
```
35+
36+
## Reference
37+
38+
| **field** | **type** | **required** | **description** |
39+
|-------------|:--------:|:------------:|----------------------------------------------------|
40+
| type | string | true | Must be "looker-get-git-branch". |
41+
| source | string | true | Name of the source. |
42+
| description | string | true | Description of the tool that is passed to the LLM. |

docs/en/integrations/looker/tools/looker-git-branch.md

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: "List Git Branches Tool"
3+
type: docs
4+
weight: 1
5+
description: >
6+
A "looker-list-git-branches" tool is used to retrieve the list of available git branches of a LookML project.
7+
---
8+
9+
## About
10+
11+
A `looker-list-git-branches` tool is used to retrieve the list of available git branches
12+
of a LookML project.
13+
14+
## Compatible Sources
15+
16+
{{< compatible-sources >}}
17+
18+
## Parameters
19+
20+
| **field** | **type** | **required** | **description** |
21+
| ---------- | :------: | :----------: | ----------------------------------------- |
22+
| project_id | string | true | The unique ID of the LookML project. |
23+
24+
## Example
25+
26+
```yaml
27+
kind: tool
28+
name: list_project_git_branches
29+
type: looker-list-git-branches
30+
source: looker-source
31+
description: |
32+
This tool is used to retrieve the list of available git branches of a LookML
33+
project.
34+
```
35+
36+
## Reference
37+
38+
| **field** | **type** | **required** | **description** |
39+
|-------------|:--------:|:------------:|----------------------------------------------------|
40+
| type | string | true | Must be "looker-list-git-branches". |
41+
| source | string | true | Name of the source. |
42+
| description | string | true | Description of the tool that is passed to the LLM. |

0 commit comments

Comments
 (0)