Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/mcp/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"iter"
"maps"
"slices"

"github.com/sourcegraph/src-cli/internal/api"

Expand Down Expand Up @@ -71,9 +73,10 @@ func (r *ToolRegistry) CallTool(ctx context.Context, client api.Client, name str

// All returns an iterator that yields the name and Tool definition of all registered tools
func (r *ToolRegistry) All() iter.Seq2[string, *ToolDef] {
keys := slices.Sorted(maps.Keys(r.tools))
return func(yield func(string, *ToolDef) bool) {
for name, def := range r.tools {
if !yield(name, def) {
for _, key := range keys {
if !yield(key, r.tools[key]) {
return
}
}
Expand Down
Loading