You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tools/datasources.go
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,7 @@ package tools
2
2
3
3
import (
4
4
"context"
5
+
"errors"
5
6
"fmt"
6
7
"strings"
7
8
@@ -12,6 +13,8 @@ import (
12
13
mcpgrafana "github.com/grafana/mcp-grafana"
13
14
)
14
15
16
+
varErrDatasourceNotFound=errors.New("datasource not found")
17
+
15
18
typeListDatasourcesParamsstruct {
16
19
Typestring`json:"type,omitempty" jsonschema:"description=The type of datasources to search for. For example\\, 'prometheus'\\, 'loki'\\, 'tempo'\\, etc..."`
returnnil, fmt.Errorf("datasource with UID '%s' not found. Please check if the datasource exists and is accessible", args.UID)
88
+
return&models.DataSource{}, fmt.Errorf("%w: datasource UID '%s' does not exist or you don't have access. Use list_datasources to see available datasources", ErrDatasourceNotFound, args.UID)
87
89
}
88
90
returnnil, fmt.Errorf("get datasource by uid %s: %w", args.UID, err)
return&models.DataSource{}, fmt.Errorf("%w: datasource with name '%s' not found; check if the datasource exists in Grafana and you have permission to access it", ErrDatasourceNotFound, args.Name)
114
+
}
110
115
returnnil, fmt.Errorf("get datasource by name %s: %w", args.Name, err)
0 commit comments