Skip to content

Commit c028507

Browse files
authored
add the specific dashboard type as this returns folders as well (#76)
1 parent 0302728 commit c028507

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ build/
55
dist/
66
wheels/
77
*.egg-info
8+
.DS_Store
9+
.vscode/
810

911
# Virtual environments
1012
.venv

tools/search.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
mcpgrafana "github.com/grafana/mcp-grafana"
1212
)
1313

14+
var dashboardTypeStr = "dash-db"
15+
1416
type SearchDashboardsParams struct {
1517
Query string `json:"query" jsonschema:"description=The query to search for"`
1618
}
@@ -20,6 +22,7 @@ func searchDashboards(ctx context.Context, args SearchDashboardsParams) (models.
2022
params := search.NewSearchParamsWithContext(ctx)
2123
if args.Query != "" {
2224
params.SetQuery(&args.Query)
25+
params.SetType(&dashboardTypeStr)
2326
}
2427
search, err := c.Search.Search(params)
2528
if err != nil {

tools/search_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package tools
88
import (
99
"testing"
1010

11+
"github.com/grafana/grafana-openapi-client-go/models"
1112
"github.com/stretchr/testify/assert"
1213
"github.com/stretchr/testify/require"
1314
)
@@ -20,5 +21,6 @@ func TestSearchTools(t *testing.T) {
2021
})
2122
require.NoError(t, err)
2223
assert.Len(t, result, 1)
24+
assert.Equal(t, models.HitType("dash-db"), result[0].Type)
2325
})
2426
}

0 commit comments

Comments
 (0)