fix for review
This commit is contained in:
parent
fbf940d2c8
commit
9ceb55a378
1 changed files with 11 additions and 8 deletions
|
|
@ -287,7 +287,8 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
|||
|
||||
mcpTool := tools.NewMCPTool(mcpManager, serverName, tool)
|
||||
|
||||
if al.cfg.Tools.MCP.Discovery.Enabled {
|
||||
cfg := al.GetConfig()
|
||||
if cfg.Tools.MCP.Discovery.Enabled {
|
||||
agent.Tools.RegisterHidden(mcpTool)
|
||||
} else {
|
||||
agent.Tools.Register(mcpTool)
|
||||
|
|
@ -313,9 +314,10 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
|||
})
|
||||
|
||||
// Initializes Discovery Tools only if enabled by configuration
|
||||
if al.cfg.Tools.MCP.Enabled && al.cfg.Tools.MCP.Discovery.Enabled {
|
||||
useBM25 := al.cfg.Tools.MCP.Discovery.UseBM25
|
||||
useRegex := al.cfg.Tools.MCP.Discovery.UseRegex
|
||||
cfg := al.GetConfig()
|
||||
if cfg.Tools.MCP.Enabled && cfg.Tools.MCP.Discovery.Enabled {
|
||||
useBM25 := cfg.Tools.MCP.Discovery.UseBM25
|
||||
useRegex := cfg.Tools.MCP.Discovery.UseRegex
|
||||
|
||||
// Fail fast: If discovery is enabled but no search method is turned on
|
||||
if !useBM25 && !useRegex {
|
||||
|
|
@ -324,12 +326,12 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
|||
)
|
||||
}
|
||||
|
||||
ttl := al.cfg.Tools.MCP.Discovery.TTL
|
||||
ttl := cfg.Tools.MCP.Discovery.TTL
|
||||
if ttl <= 0 {
|
||||
ttl = 5 // Default value
|
||||
}
|
||||
|
||||
maxSearchResults := al.cfg.Tools.MCP.Discovery.MaxSearchResults
|
||||
maxSearchResults := cfg.Tools.MCP.Discovery.MaxSearchResults
|
||||
if maxSearchResults <= 0 {
|
||||
maxSearchResults = 5 // Default value
|
||||
}
|
||||
|
|
@ -338,8 +340,9 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
|||
"bm25": useBM25, "regex": useRegex, "ttl": ttl, "max_results": maxSearchResults,
|
||||
})
|
||||
|
||||
registry := al.GetRegistry()
|
||||
for _, agentID := range agentIDs {
|
||||
agent, ok := al.registry.GetAgent(agentID)
|
||||
agent, ok := registry.GetAgent(agentID)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
|
@ -432,7 +435,7 @@ func (al *AgentLoop) Stop() {
|
|||
|
||||
// Close releases resources held by agent session stores. Call after Stop.
|
||||
func (al *AgentLoop) Close() {
|
||||
al.registry.Close()
|
||||
al.GetRegistry().Close()
|
||||
}
|
||||
|
||||
func (al *AgentLoop) RegisterTool(tool tools.Tool) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue