Skip to content

Commit 42be3f5

Browse files
feat(tools/looker): New Looker tools for dashboards (googleapis#1118)
* get_dashboards * make_dashboard * add_dashboard_element
1 parent 6f55b78 commit 42be3f5

16 files changed

Lines changed: 1718 additions & 11 deletions

File tree

‎cmd/root.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,16 @@ import (
6161
_ "github.com/googleapis/genai-toolbox/internal/tools/firestore/firestorequerycollection"
6262
_ "github.com/googleapis/genai-toolbox/internal/tools/firestore/firestorevalidaterules"
6363
_ "github.com/googleapis/genai-toolbox/internal/tools/http"
64+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookeradddashboardelement"
65+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetdashboards"
6466
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetdimensions"
6567
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetexplores"
6668
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetfilters"
6769
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetlooks"
6870
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetmeasures"
6971
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetmodels"
7072
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookergetparameters"
73+
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookermakedashboard"
7174
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookermakelook"
7275
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerquery"
7376
_ "github.com/googleapis/genai-toolbox/internal/tools/looker/lookerquerysql"

‎cmd/root_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ func TestPrebuiltTools(t *testing.T) {
12901290
wantToolset: server.ToolsetConfigs{
12911291
"looker-tools": tools.ToolsetConfig{
12921292
Name: "looker-tools",
1293-
ToolNames: []string{"get_models", "get_explores", "get_dimensions", "get_measures", "get_filters", "get_parameters", "query", "query_sql", "query_url", "get_looks", "run_look", "make_look"},
1293+
ToolNames: []string{"get_models", "get_explores", "get_dimensions", "get_measures", "get_filters", "get_parameters", "query", "query_sql", "query_url", "get_looks", "run_look", "make_look", "get_dashboards", "make_dashboard", "add_dashboard_element"},
12941294
},
12951295
},
12961296
},
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: "looker-add-dashboard-element"
3+
type: docs
4+
weight: 1
5+
description: >
6+
"looker-add-dashboard-element" generates a Looker look in the users personal folder in
7+
Looker
8+
aliases:
9+
- /resources/tools/looker-add-dashboard-element
10+
---
11+
12+
## About
13+
14+
The `looker-add-dashboard-element` creates a dashboard element
15+
in the given dashboard.
16+
17+
It's compatible with the following sources:
18+
19+
- [looker](../../sources/looker.md)
20+
21+
`looker-add-dashboard-element` takes eleven parameters:
22+
23+
1. the `model`
24+
2. the `explore`
25+
3. the `fields` list
26+
4. an optional set of `filters`
27+
5. an optional set of `pivots`
28+
6. an optional set of `sorts`
29+
7. an optional `limit`
30+
8. an optional `tz`
31+
9. an optional `vis_config`
32+
10. the `title`
33+
11. the `dashboard_id`
34+
35+
## Example
36+
37+
```yaml
38+
tools:
39+
add_dashboard_element:
40+
kind: looker-add-dashboard-element
41+
source: looker-source
42+
description: |
43+
add_dashboard_element Tool
44+
45+
This tool creates a new tile in a Looker dashboard using
46+
the query parameters and the vis_config specified.
47+
48+
Most of the parameters are the same as the query_url
49+
tool. In addition, there is a title that may be provided.
50+
The dashboard_id must be specified. That is obtained
51+
from calling make_dashboard.
52+
53+
This tool can be called many times for one dashboard_id
54+
and the resulting tiles will be added in order.
55+
```
56+
57+
## Reference
58+
59+
| **field** | **type** | **required** | **description** |
60+
|-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------|
61+
| kind | string | true | Must be "looker-add-dashboard-element" |
62+
| source | string | true | Name of the source the SQL should execute on. |
63+
| description | string | true | Description of the tool that is passed to the LLM. |
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: "looker-get-dashboards"
3+
type: docs
4+
weight: 1
5+
description: >
6+
"looker-get-dashboards" searches for saved Looks in a Looker
7+
source.
8+
aliases:
9+
- /resources/tools/looker-get-dashboards
10+
---
11+
12+
## About
13+
14+
The `looker-get-dashboards` tool searches for a saved Dashboard by
15+
name or description.
16+
17+
It's compatible with the following sources:
18+
19+
- [looker](../../sources/looker.md)
20+
21+
`looker-get-dashboards` takes four parameters, the `title`, `desc`, `limit`
22+
and `offset`.
23+
24+
Title and description use SQL style wildcards and are case insensitive.
25+
26+
Limit and offset are used to page through a larger set of matches and
27+
default to 100 and 0.
28+
29+
## Example
30+
31+
```yaml
32+
tools:
33+
get_dashboards:
34+
kind: looker-get-dashboards
35+
source: looker-source
36+
description: |
37+
get_dashboards Tool
38+
39+
This tool is used to search for saved dashboards in a Looker instance.
40+
String search params use case-insensitive matching. String search
41+
params can contain % and '_' as SQL LIKE pattern match wildcard
42+
expressions. example="dan%" will match "danger" and "Danzig" but
43+
not "David" example="D_m%" will match "Damage" and "dump".
44+
45+
Most search params can accept "IS NULL" and "NOT NULL" as special
46+
expressions to match or exclude (respectively) rows where the
47+
column is null.
48+
49+
The limit and offset are used to paginate the results.
50+
51+
The result of the get_dashboards tool is a list of json objects.
52+
```
53+
54+
## Reference
55+
56+
| **field** | **type** | **required** | **description** |
57+
|-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------|
58+
| kind | string | true | Must be "looker-get-dashboards" |
59+
| source | string | true | Name of the source the SQL should execute on. |
60+
| description | string | true | Description of the tool that is passed to the LLM. |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: "looker-make-dashboard"
3+
type: docs
4+
weight: 1
5+
description: >
6+
"looker-make-dashboard" generates a Looker dashboard in the users personal folder in
7+
Looker
8+
aliases:
9+
- /resources/tools/looker-make-dashboard
10+
---
11+
12+
## About
13+
14+
The `looker-make-dashboard` creates a dashboard in the user's
15+
Looker personal folder.
16+
17+
It's compatible with the following sources:
18+
19+
- [looker](../../sources/looker.md)
20+
21+
`looker-make-dashboard` takes one parameter:
22+
23+
1. the `title`
24+
25+
## Example
26+
27+
```yaml
28+
tools:
29+
make_dashboard:
30+
kind: looker-make-dashboard
31+
source: looker-source
32+
description: |
33+
make_dashboard Tool
34+
35+
This tool creates a new dashboard in Looker. The dashboard is
36+
initially empty and the add_dashboard_element tool is used to
37+
add content to the dashboard.
38+
39+
The newly created dashboard will be created in the user's
40+
personal folder in looker. The dashboard name must be unique.
41+
42+
The result is a json document with a link to the newly
43+
created dashboard and the id of the dashboard. Use the id
44+
when calling add_dashboard_element.
45+
```
46+
47+
## Reference
48+
49+
| **field** | **type** | **required** | **description** |
50+
|-------------|:------------------------------------------:|:------------:|--------------------------------------------------------------------------------------------------|
51+
| kind | string | true | Must be "looker-make-dashboard" |
52+
| source | string | true | Name of the source the SQL should execute on. |
53+
| description | string | true | Description of the tool that is passed to the LLM. |

‎docs/en/resources/tools/looker/looker-make-look.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ It's compatible with the following sources:
1818

1919
- [looker](../../sources/looker.md)
2020

21-
`looker-make-look` takes eight parameters:
21+
`looker-make-look` takes eleven parameters:
2222

2323
1. the `model`
2424
2. the `explore`

‎docs/en/resources/tools/looker/looker-query-url.md‎

Lines changed: 133 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ It's compatible with the following sources:
1717

1818
- [looker](../../sources/looker.md)
1919

20-
`looker-query-url` takes eight parameters:
20+
`looker-query-url` takes nine parameters:
2121

2222
1. the `model`
2323
2. the `explore`
@@ -46,8 +46,121 @@ tools:
4646
parameter.
4747
4848
The vis_config is optional. If provided, it will be used to
49-
control the default visualization for the query. These are
50-
some sample vis_config settings.
49+
control the default visualization for the query. Here are
50+
some notes on making visualizations.
51+
52+
### Cartesian Charts (Area, Bar, Column, Line, Scatter)
53+
54+
These chart types share a large number of configuration options.
55+
56+
**General**
57+
* `type`: The type of visualization (`looker_area`, `looker_bar`, `looker_column`, `looker_line`, `looker_scatter`).
58+
* `series_types`: Override the chart type for individual series.
59+
* `show_view_names`: Display view names in labels and tooltips (`true`/`false`).
60+
* `series_labels`: Provide custom names for series.
61+
62+
**Styling & Colors**
63+
* `colors`: An array of color values to be used for the chart series.
64+
* `series_colors`: A mapping of series names to specific color values.
65+
* `color_application`: Advanced controls for color palette application (collection, palette, reverse, etc.).
66+
* `font_size`: Font size for labels (e.g., '12px').
67+
68+
**Legend**
69+
* `hide_legend`: Show or hide the chart legend (`true`/`false`).
70+
* `legend_position`: Placement of the legend (`'center'`, `'left'`, `'right'`).
71+
72+
**Axes**
73+
* `swap_axes`: Swap the X and Y axes (`true`/`false`).
74+
* `x_axis_scale`: Scale of the x-axis (`'auto'`, `'ordinal'`, `'linear'`, `'time'`).
75+
* `x_axis_reversed`, `y_axis_reversed`: Reverse the direction of an axis (`true`/`false`).
76+
* `x_axis_gridlines`, `y_axis_gridlines`: Display gridlines for an axis (`true`/`false`).
77+
* `show_x_axis_label`, `show_y_axis_label`: Show or hide the axis title (`true`/`false`).
78+
* `show_x_axis_ticks`, `show_y_axis_ticks`: Show or hide axis tick marks (`true`/`false`).
79+
* `x_axis_label`, `y_axis_label`: Set a custom title for an axis.
80+
* `x_axis_datetime_label`: A format string for datetime labels on the x-axis (e.g., `'%Y-%m'`).
81+
* `x_padding_left`, `x_padding_right`: Adjust padding on the ends of the x-axis.
82+
* `x_axis_label_rotation`, `x_axis_label_rotation_bar`: Set rotation for x-axis labels.
83+
* `x_axis_zoom`, `y_axis_zoom`: Enable zooming on an axis (`true`/`false`).
84+
* `y_axes`: An array of configuration objects for multiple y-axes.
85+
86+
**Data & Series**
87+
* `stacking`: How to stack series (`''` for none, `'normal'`, `'percent'`).
88+
* `ordering`: Order of series in a stack (`'none'`, etc.).
89+
* `limit_displayed_rows`: Enable or disable limiting the number of rows displayed (`true`/`false`).
90+
* `limit_displayed_rows_values`: Configuration for the row limit (e.g., `{ "first_last": "first", "show_hide": "show", "num_rows": 10 }`).
91+
* `discontinuous_nulls`: How to render null values in line charts (`true`/`false`).
92+
* `point_style`: Style for points on line and area charts (`'none'`, `'circle'`, `'circle_outline'`).
93+
* `series_point_styles`: Override point styles for individual series.
94+
* `interpolation`: Line interpolation style (`'linear'`, `'monotone'`, `'step'`, etc.).
95+
* `show_value_labels`: Display values on data points (`true`/`false`).
96+
* `label_value_format`: A format string for value labels.
97+
* `show_totals_labels`: Display total labels on stacked charts (`true`/`false`).
98+
* `totals_color`: Color for total labels.
99+
* `show_silhouette`: Display a "silhouette" of hidden series in stacked charts (`true`/`false`).
100+
* `hidden_series`: An array of series names to hide from the visualization.
101+
102+
**Scatter/Bubble Specific**
103+
* `size_by_field`: The field used to determine the size of bubbles.
104+
* `color_by_field`: The field used to determine the color of bubbles.
105+
* `plot_size_by_field`: Whether to display the size-by field in the legend.
106+
* `cluster_points`: Group nearby points into clusters (`true`/`false`).
107+
* `quadrants_enabled`: Display quadrants on the chart (`true`/`false`).
108+
* `quadrant_properties`: Configuration for quadrant labels and colors.
109+
* `custom_quadrant_value_x`, `custom_quadrant_value_y`: Set quadrant boundaries as a percentage.
110+
* `custom_quadrant_point_x`, `custom_quadrant_point_y`: Set quadrant boundaries to a specific value.
111+
112+
**Miscellaneous**
113+
* `reference_lines`: Configuration for displaying reference lines.
114+
* `trend_lines`: Configuration for displaying trend lines.
115+
* `trellis`: Configuration for creating trellis (small multiple) charts.
116+
* `crossfilterEnabled`, `crossfilters`: Configuration for cross-filtering interactions.
117+
118+
### Boxplot
119+
120+
* Inherits most of the Cartesian chart options.
121+
* `type`: Must be `looker_boxplot`.
122+
123+
### Funnel
124+
125+
* `type`: Must be `looker_funnel`.
126+
* `orientation`: How data is read (`'automatic'`, `'dataInRows'`, `'dataInColumns'`).
127+
* `percentType`: How percentages are calculated (`'percentOfMaxValue'`, `'percentOfPriorRow'`).
128+
* `labelPosition`, `valuePosition`, `percentPosition`: Placement of labels (`'left'`, `'right'`, `'inline'`, `'hidden'`).
129+
* `labelColor`, `labelColorEnabled`: Set a custom color for labels.
130+
* `labelOverlap`: Allow labels to overlap (`true`/`false`).
131+
* `barColors`: An array of colors for the funnel steps.
132+
* `color_application`: Advanced color palette controls.
133+
* `crossfilterEnabled`, `crossfilters`: Configuration for cross-filtering.
134+
135+
### Pie / Donut
136+
137+
* `type`: Must be `looker_pie`.
138+
* `value_labels`: Where to display values (`'legend'`, `'labels'`).
139+
* `label_type`: The format of data labels (`'labPer'`, `'labVal'`, `'lab'`, `'val'`, `'per'`).
140+
* `start_angle`, `end_angle`: The start and end angles of the pie chart.
141+
* `inner_radius`: The inner radius, used to create a donut chart.
142+
* `series_colors`, `series_labels`: Override colors and labels for specific slices.
143+
* `color_application`: Advanced color palette controls.
144+
* `crossfilterEnabled`, `crossfilters`: Configuration for cross-filtering.
145+
* `advanced_vis_config`: A string containing JSON for advanced Highcharts configuration.
146+
147+
### Waterfall
148+
149+
* Inherits most of the Cartesian chart options.
150+
* `type`: Must be `looker_waterfall`.
151+
* `up_color`: Color for positive (increasing) values.
152+
* `down_color`: Color for negative (decreasing) values.
153+
* `total_color`: Color for the total bar.
154+
155+
### Word Cloud
156+
157+
* `type`: Must be `looker_wordcloud`.
158+
* `rotation`: Enable random word rotation (`true`/`false`).
159+
* `colors`: An array of colors for the words.
160+
* `color_application`: Advanced color palette controls.
161+
* `crossfilterEnabled`, `crossfilters`: Configuration for cross-filtering.
162+
163+
These are some sample vis_config settings.
51164
52165
A bar chart -
53166
{{
@@ -307,13 +420,29 @@ tools:
307420
"y_axis_zoom": true
308421
}}
309422
310-
A single value visualization -
423+
A single record visualization -
311424
{{
312425
"defaults_version": 1,
313426
"show_view_names": false,
314427
"type": "looker_single_record"
315428
}}
316429
430+
A single value visualization -
431+
{{
432+
"comparison_reverse_colors": false,
433+
"comparison_type": "value", "conditional_formatting_include_nulls": false, "conditional_formatting_include_totals": false,
434+
"custom_color": "#1A73E8",
435+
"custom_color_enabled": true,
436+
"defaults_version": 1,
437+
"enable_conditional_formatting": false,
438+
"series_types": {},
439+
"show_comparison": false,
440+
"show_comparison_label": true,
441+
"show_single_value_title": true,
442+
"single_value_title": "Total Clicks",
443+
"type": "single_value"
444+
}}
445+
317446
A Pie chart -
318447
{{
319448
"defaults_version": 1,

0 commit comments

Comments
 (0)