mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
improve(agent): clarify MCP tool registration logging
Separate tool counting metrics for better clarity: - unique_tools: number of distinct MCP tools - total_registrations: total tool registrations across all agents - agent_count: number of agents receiving the tools Previously, tool_count was misleading as it showed total registrations, making it appear that more unique tools were registered than actually exist. Addresses Copilot code review feedback.
This commit is contained in:
+10
-4
@@ -162,8 +162,12 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
||||
|
||||
// Register MCP tools for all agents
|
||||
servers := mcpManager.GetServers()
|
||||
toolCount := 0
|
||||
uniqueTools := 0
|
||||
totalRegistrations := 0
|
||||
agentCount := len(al.registry.ListAgentIDs())
|
||||
|
||||
for serverName, conn := range servers {
|
||||
uniqueTools += len(conn.Tools)
|
||||
for _, tool := range conn.Tools {
|
||||
for _, agentID := range al.registry.ListAgentIDs() {
|
||||
agent, ok := al.registry.GetAgent(agentID)
|
||||
@@ -172,7 +176,7 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
||||
}
|
||||
mcpTool := tools.NewMCPTool(mcpManager, serverName, tool)
|
||||
agent.Tools.Register(mcpTool)
|
||||
toolCount++
|
||||
totalRegistrations++
|
||||
logger.DebugCF("agent", "Registered MCP tool",
|
||||
map[string]interface{}{
|
||||
"agent_id": agentID,
|
||||
@@ -185,8 +189,10 @@ func (al *AgentLoop) Run(ctx context.Context) error {
|
||||
}
|
||||
logger.InfoCF("agent", "MCP tools registered successfully",
|
||||
map[string]interface{}{
|
||||
"server_count": len(servers),
|
||||
"tool_count": toolCount,
|
||||
"server_count": len(servers),
|
||||
"unique_tools": uniqueTools,
|
||||
"total_registrations": totalRegistrations,
|
||||
"agent_count": agentCount,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user