File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "context"
55 "encoding/json"
66 "fmt"
7+ "strings"
78
89 "github.com/modelcontextprotocol/go-sdk/mcp"
910 "github.com/rilldata/rill/runtime"
@@ -48,8 +49,18 @@ func (t *GetCanvas) Spec() *mcp.Tool {
4849}
4950
5051func (t * GetCanvas ) CheckAccess (ctx context.Context ) (bool , error ) {
52+ // Must be allowed to use AI and query objects
5153 s := GetSession (ctx )
52- return s .Claims ().Can (runtime .ReadObjects ), nil
54+ if ! s .Claims ().Can (runtime .UseAI ) || ! s .Claims ().Can (runtime .ReadObjects ) {
55+ return false , nil
56+ }
57+
58+ // Only allow for rill user agents since it's not useful in MCP contexts.
59+ if ! strings .HasPrefix (s .CatalogSession ().UserAgent , "rill" ) {
60+ return false , nil
61+ }
62+
63+ return true , nil
5364}
5465
5566func (t * GetCanvas ) Handler (ctx context.Context , args * GetCanvasArgs ) (* GetCanvasResult , error ) {
Original file line number Diff line number Diff line change @@ -71,7 +71,6 @@ explore:
7171 expectedTools := []string {
7272 ai .ListMetricsViewsName ,
7373 ai .GetMetricsViewName ,
74- ai .GetCanvasName ,
7574 ai .QueryMetricsViewName ,
7675 ai .QueryMetricsViewSummaryName ,
7776 ai .ProjectStatusName ,
You can’t perform that action at this time.
0 commit comments