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

Method Init

aibridge/mcp/server_proxy_manager.go:52–72  ·  view source on GitHub ↗

Init concurrently initializes all of its [ServerProxier]s.

(ctx context.Context)

Source from the content-addressed store, hash-verified

50
51// Init concurrently initializes all of its [ServerProxier]s.
52func (s *ServerProxyManager) Init(ctx context.Context) (outErr error) {
53 ctx, span := s.tracer.Start(ctx, "ServerProxyManager.Init")
54 defer tracing.EndSpanErr(span, &outErr)
55
56 cg := utils.NewConcurrentGroup()
57 for _, proxy := range s.proxiers {
58 cg.Go(func() error {
59 return proxy.Init(ctx)
60 })
61 }
62
63 // Wait for all servers to initialize and load their tools.
64 err := cg.Wait()
65
66 // Aggregate all proxiers' tools.
67 for _, proxy := range s.proxiers {
68 s.addTools(proxy.ListTools())
69 }
70
71 return err
72}
73
74func (s *ServerProxyManager) GetTool(name string) *Tool {
75 s.toolsMu.RLock()

Callers 2

setupMCPForTestWithNameFunction · 0.95
TestToolInjectionOrderFunction · 0.95

Calls 8

GoMethod · 0.95
WaitMethod · 0.95
addToolsMethod · 0.95
EndSpanErrFunction · 0.92
NewConcurrentGroupFunction · 0.92
StartMethod · 0.65
InitMethod · 0.65
ListToolsMethod · 0.65

Tested by 1

TestToolInjectionOrderFunction · 0.76