MCPcopy Index your code
hub / github.com/coder/coder / validateToolOrder

Function validateToolOrder

aibridge/mcp/mcp_test.go:335–350  ·  view source on GitHub ↗
(t *testing.T, proxy mcp.ServerProxier)

Source from the content-addressed store, hash-verified

333}
334
335func validateToolOrder(t *testing.T, proxy mcp.ServerProxier) {
336 t.Helper()
337
338 tools := proxy.ListTools()
339 require.NotEmpty(t, tools)
340 require.Greater(t, len(tools), 1)
341
342 // Ensure tools are sorted by ID; unstable order can bust the cache and lead to increased costs.
343 sorted := slices.Clone(tools)
344 slices.SortFunc(sorted, func(a, b *mcp.Tool) int {
345 return strings.Compare(a.ID, b.ID)
346 })
347 for i, tool := range tools {
348 require.Equal(t, tool.ID, sorted[i].ID, "tool order is not stable")
349 }
350}
351
352func createMockMCPSrv(t *testing.T) http.Handler {
353 t.Helper()

Callers 1

TestToolInjectionOrderFunction · 0.85

Calls 6

NotEmptyMethod · 0.80
CompareMethod · 0.80
HelperMethod · 0.65
ListToolsMethod · 0.65
CloneMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected