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)
| 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). |
| 168 | func 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. |
| 191 | func defaultOLAPInfo(ctx context.Context, rt *runtime.Runtime, instanceID string) (string, error) { |
no test coverage detected