MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / SearchPaged

Method SearchPaged

internal/metadata/refresh.go:512–546  ·  view source on GitHub ↗

SearchPaged runs a paginated search and decorates each item with the list of code agents it is currently installed to.

(ctx context.Context, q SearchQuery)

Source from the content-addressed store, hash-verified

510// SearchPaged runs a paginated search and decorates each item with the list of
511// code agents it is currently installed to.
512func (svc *Service) SearchPaged(ctx context.Context, q SearchQuery) (SearchResponse, error) {
513 items, err := svc.store.Search(ctx, q)
514 if err != nil {
515 return SearchResponse{}, err
516 }
517 total, err := svc.store.Count(ctx, q)
518 if err != nil {
519 return SearchResponse{}, err
520 }
521 if q.Kind == "skill" && strings.TrimSpace(q.Query) != "" && total == 0 {
522 limit := q.Limit
523 if limit <= 0 {
524 limit = 100
525 }
526 if _, err := svc.RefreshOnlineSkillSearch(ctx, q.Query, limit); err != nil {
527 return SearchResponse{}, err
528 }
529 items, err = svc.store.Search(ctx, q)
530 if err != nil {
531 return SearchResponse{}, err
532 }
533 total, err = svc.store.Count(ctx, q)
534 if err != nil {
535 return SearchResponse{}, err
536 }
537 }
538 for i := range items {
539 items[i].InstalledApps = InstalledAppsFor(items[i])
540 }
541 limit := q.Limit
542 if limit <= 0 {
543 limit = 100
544 }
545 return SearchResponse{Items: items, Total: total, Limit: limit, Offset: q.Offset}, nil
546}
547
548// InstalledAppsFor returns the code agent IDs where the item is installed on disk.
549// An item is considered installed to an app when a directory named after the item

Calls 4

InstalledAppsForFunction · 0.85
CountMethod · 0.80
SearchMethod · 0.45