Skip to content

Commit e2cac2d

Browse files
committed
Move code next to where it's used
Signed-off-by: David Gageot <[email protected]>
1 parent 3d99698 commit e2cac2d

File tree

1 file changed

+15
-15
lines changed
  • cmd/docker-mcp/internal/gateway

1 file changed

+15
-15
lines changed

cmd/docker-mcp/internal/gateway/run.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ func (g *Gateway) Run(ctx context.Context) error {
6666
}
6767
defer func() { _ = stopConfigWatcher() }()
6868

69-
// Which servers are enabled in the registry.yaml?
70-
serverNames := configuration.ServerNames()
71-
if len(serverNames) == 0 {
72-
log("- No server is enabled")
73-
} else {
74-
log("- Those servers are enabled:", strings.Join(serverNames, ", "))
75-
}
76-
7769
// Which docker images are used?
7870
// Pull them and verify them if possible.
7971
if !g.Static {
@@ -91,6 +83,21 @@ func (g *Gateway) Run(ctx context.Context) error {
9183
}
9284
}
9385

86+
// Build a list of interceptors.
87+
customInterceptors, err := interceptors.Parse(g.Interceptors)
88+
if err != nil {
89+
return fmt.Errorf("parsing interceptors: %w", err)
90+
}
91+
toolCallbacks := interceptors.Callbacks(g.LogCalls, g.BlockSecrets, customInterceptors)
92+
93+
// Which servers are enabled in the registry.yaml?
94+
serverNames := configuration.ServerNames()
95+
if len(serverNames) == 0 {
96+
log("- No server is enabled")
97+
} else {
98+
log("- Those servers are enabled:", strings.Join(serverNames, ", "))
99+
}
100+
94101
// List all the available tools.
95102
startList := time.Now()
96103
log("- Listing MCP tools...")
@@ -100,13 +107,6 @@ func (g *Gateway) Run(ctx context.Context) error {
100107
}
101108
log(">", len(capabilities.Tools), "tools listed in", time.Since(startList))
102109

103-
// Build a list of interceptors.
104-
customInterceptors, err := interceptors.Parse(g.Interceptors)
105-
if err != nil {
106-
return fmt.Errorf("parsing interceptors: %w", err)
107-
}
108-
toolCallbacks := interceptors.Callbacks(g.LogCalls, g.BlockSecrets, customInterceptors)
109-
110110
// TODO: cleanup stopped servers. That happens in stdio over TCP mode.
111111
var (
112112
lock sync.Mutex

0 commit comments

Comments
 (0)