Skip to content

Commit 3513197

Browse files
authored
Merge branch 'main' into wb/remove-deepsearch-endpoint
2 parents e1a34e7 + fcce499 commit 3513197

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

internal/mcp/registry.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"context"
55
"encoding/json"
66
"iter"
7+
"maps"
8+
"slices"
79

810
"github.com/sourcegraph/src-cli/internal/api"
911
)
@@ -48,9 +50,10 @@ func (r *ToolRegistry) CallTool(ctx context.Context, client api.Client, name str
4850

4951
// All returns an iterator that yields the name and Tool definition of all registered tools
5052
func (r *ToolRegistry) All() iter.Seq2[string, *ToolDef] {
53+
keys := slices.Sorted(maps.Keys(r.tools))
5154
return func(yield func(string, *ToolDef) bool) {
52-
for name, def := range r.tools {
53-
if !yield(name, def) {
55+
for _, key := range keys {
56+
if !yield(key, r.tools[key]) {
5457
return
5558
}
5659
}

0 commit comments

Comments
 (0)