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

Function nativeApplyResourceScope

internal/daemon/native_bundle_resource_tools.go:378–400  ·  view source on GitHub ↗
(
	id toolspkg.ToolID,
	filter *resources.ResourceFilter,
	scope toolspkg.Scope,
)

Source from the content-addressed store, hash-verified

376}
377
378func nativeApplyResourceScope(
379 id toolspkg.ToolID,
380 filter *resources.ResourceFilter,
381 scope toolspkg.Scope,
382) error {
383 if filter == nil || scope.Operator || strings.TrimSpace(scope.WorkspaceID) == "" {
384 return nil
385 }
386 workspaceScope := resources.ResourceScope{
387 Kind: resources.ResourceScopeKindWorkspace,
388 ID: strings.TrimSpace(scope.WorkspaceID),
389 }
390 if filter.Scope == nil {
391 filter.Scope = &workspaceScope
392 return nil
393 }
394 if filter.Scope.Kind.Normalize() != resources.ResourceScopeKindWorkspace ||
395 strings.TrimSpace(filter.Scope.ID) != workspaceScope.ID {
396 return nativeScopeMismatchError(id, "scope")
397 }
398 filter.Scope.ID = workspaceScope.ID
399 return nil
400}
401
402func nativeResourceRecordAllowed(scope toolspkg.Scope, record resources.RawRecord) bool {
403 if scope.Operator || strings.TrimSpace(scope.WorkspaceID) == "" {

Callers 1

Calls 2

nativeScopeMismatchErrorFunction · 0.85
NormalizeMethod · 0.45

Tested by

no test coverage detected