MCPcopy Create free account
hub / github.com/rilldata/rill / checkDeveloperAccess

Function checkDeveloperAccess

runtime/ai/developer_agent.go:168–188  ·  view source on GitHub ↗

checkDeveloperAccess checks whether developer tools should be available in the current session. If internal is true, it indicates that the tool should not be exposed to external clients (like MCP).

(ctx context.Context, rt *runtime.Runtime, internal bool)

Source from the content-addressed store, hash-verified

166// checkDeveloperAccess checks whether developer tools should be available in the current session.
167// If internal is true, it indicates that the tool should not be exposed to external clients (like MCP).
168func checkDeveloperAccess(ctx context.Context, rt *runtime.Runtime, internal bool) (bool, error) {
169 // Must be able to use AI and edit the project
170 s := GetSession(ctx)
171 if !s.Claims().Can(runtime.UseAI) || !s.Claims().Can(runtime.EditRepo) {
172 return false, nil
173 }
174
175 // Don't expose agent tools to external clients (like MCP)
176 if internal {
177 if !strings.HasPrefix(s.CatalogSession().UserAgent, "rill") {
178 return false, nil
179 }
180 }
181
182 // Must have the developer_agent feature flag
183 ff, err := rt.FeatureFlags(ctx, s.InstanceID(), s.Claims())
184 if err != nil {
185 return false, err
186 }
187 return ff["developer_agent"], nil
188}
189
190// defaultOLAPInfo returns info about the default OLAP connector name, driver, and whether it is in readwrite mode.
191func defaultOLAPInfo(ctx context.Context, rt *runtime.Runtime, instanceID string) (string, error) {

Callers 12

CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85
CheckAccessMethod · 0.85

Calls 6

GetSessionFunction · 0.85
CanMethod · 0.80
CatalogSessionMethod · 0.80
FeatureFlagsMethod · 0.80
InstanceIDMethod · 0.80
ClaimsMethod · 0.65

Tested by

no test coverage detected