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

Method resolveSkill

internal/daemon/native_tools.go:3561–3590  ·  view source on GitHub ↗
(
	ctx context.Context,
	scope toolspkg.Scope,
	id toolspkg.ToolID,
	workspaceID string,
	name string,
)

Source from the content-addressed store, hash-verified

3559}
3560
3561func (n *daemonNativeTools) resolveSkill(
3562 ctx context.Context,
3563 scope toolspkg.Scope,
3564 id toolspkg.ToolID,
3565 workspaceID string,
3566 name string,
3567) (*skills.Skill, error) {
3568 trimmedName := strings.TrimSpace(name)
3569 workspaceID, err := nativeCallerWorkspaceInput(id, "workspace_id", workspaceID, scope)
3570 if err != nil {
3571 return nil, err
3572 }
3573 if workspaceID == "" {
3574 skill, ok := n.deps.Skills.Get(trimmedName)
3575 if !ok {
3576 return nil, fmt.Errorf("daemon: skill %q not found", trimmedName)
3577 }
3578 return skill, nil
3579 }
3580 skillList, err := n.skillsFor(ctx, scope, id, workspaceID)
3581 if err != nil {
3582 return nil, err
3583 }
3584 for _, skill := range skillList {
3585 if skill != nil && skill.Meta.Name == trimmedName {
3586 return skill, nil
3587 }
3588 }
3589 return nil, fmt.Errorf("daemon: skill %q not found", trimmedName)
3590}
3591
3592func (n *daemonNativeTools) workspaceID(ctx context.Context, ref string) (string, error) {
3593 trimmed := strings.TrimSpace(ref)

Callers 1

skillViewMethod · 0.95

Calls 3

skillsForMethod · 0.95
GetMethod · 0.65

Tested by

no test coverage detected