MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / CountClearedToolResult

Function CountClearedToolResult

agentContext/micro.go:157–176  ·  view source on GitHub ↗
(messages []map[string]any)

Source from the content-addressed store, hash-verified

155}
156
157func CountClearedToolResult(messages []map[string]any) int {
158 count := 0
159 for _, msg := range messages {
160 content, ok := contentBlocks(msg["content"])
161 if !ok {
162 continue
163 }
164 for _, item := range content {
165 itemContent, ok := item["content"].(string)
166 if !ok {
167 continue
168 }
169 itemType := getValueFrom(item, "type")
170 if itemType == "tool_result" && itemContent == cleanPlaceHolder {
171 count++
172 }
173 }
174 }
175 return count
176}
177
178func MicroCompactResult(content string, maxCharsOpt ...int) string {
179 maxChars := defaultMaxResultChars

Calls 2

getValueFromFunction · 0.85
contentBlocksFunction · 0.70