MCPcopy Create free account
hub / github.com/compozy/agh / nativeBundleActivationScope

Function nativeBundleActivationScope

internal/daemon/native_bundle_resource_tools.go:270–299  ·  view source on GitHub ↗
(
	id toolspkg.ToolID,
	input bundleActivateToolInput,
	scope toolspkg.Scope,
)

Source from the content-addressed store, hash-verified

268}
269
270func nativeBundleActivationScope(
271 id toolspkg.ToolID,
272 input bundleActivateToolInput,
273 scope toolspkg.Scope,
274) (bundlepkg.Scope, string, error) {
275 activationScope := bundlepkg.Scope(strings.TrimSpace(input.Scope)).Normalize()
276 if activationScope == "" {
277 activationScope = bundlepkg.ScopeGlobal
278 if strings.TrimSpace(scope.WorkspaceID) != "" {
279 activationScope = bundlepkg.ScopeWorkspace
280 }
281 }
282 if !scope.Operator && strings.TrimSpace(scope.WorkspaceID) != "" && activationScope != bundlepkg.ScopeWorkspace {
283 return "", "", nativeScopeMismatchError(id, "scope")
284 }
285 workspaceID := ""
286 if activationScope == bundlepkg.ScopeWorkspace {
287 resolved, err := nativeCallerWorkspaceInput(id, "workspace", input.Workspace, scope)
288 if err != nil {
289 return "", "", err
290 }
291 if strings.TrimSpace(resolved) == "" {
292 return "", "", nativeRequiredInputError(id, "workspace")
293 }
294 workspaceID = resolved
295 } else if strings.TrimSpace(input.Workspace) != "" {
296 return "", "", nativeScopeMismatchError(id, "workspace")
297 }
298 return activationScope, workspaceID, nil
299}
300
301func nativeBundleActivationsForScope(
302 scope toolspkg.Scope,

Callers 1

bundlesActivateMethod · 0.85

Calls 5

nativeScopeMismatchErrorFunction · 0.85
nativeRequiredInputErrorFunction · 0.85
ScopeMethod · 0.80
NormalizeMethod · 0.45

Tested by

no test coverage detected