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

Method Tools

agent/x/agentmcp/manager.go:202–219  ·  view source on GitHub ↗

Tools returns the current MCP tool cache after startup-safe config synchronization. Before startup has settled via MarkStartupSettled, Tools blocks until settlement or ctx cancels. After settlement, it drives a config reload bounded by toolsReloadTimeout. On error before the first sync settles, To

(ctx context.Context, paths []string)

Source from the content-addressed store, hash-verified

200// the error. On error after a prior sync, it returns cached tools and
201// the error so callers can degrade gracefully.
202func (m *Manager) Tools(ctx context.Context, paths []string) ([]workspacesdk.MCPToolInfo, error) {
203 if err := m.waitForStartupSettled(ctx); err != nil {
204 return nil, err
205 }
206
207 ch, started, err := m.startReloadIfNeeded(paths)
208 if err != nil {
209 return m.toolsAfterReloadError(err)
210 }
211 if !started {
212 return normalizeTools(m.cachedTools()), nil
213 }
214
215 if err := m.waitReload(ctx, ch, toolsReloadTimeout); err != nil {
216 return m.toolsAfterReloadError(err)
217 }
218 return normalizeTools(m.cachedTools()), nil
219}
220
221func (m *Manager) waitForStartupSettled(ctx context.Context) error {
222 select {

Callers 2

handleListToolsMethod · 0.80

Calls 6

waitForStartupSettledMethod · 0.95
startReloadIfNeededMethod · 0.95
toolsAfterReloadErrorMethod · 0.95
cachedToolsMethod · 0.95
waitReloadMethod · 0.95
normalizeToolsFunction · 0.70

Tested by 1