MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / renderToolCard

Method renderToolCard

internal/tui/log.go:390–418  ·  view source on GitHub ↗

renderToolCard renders a tool call as a single styled line with icon and argument.

(entry LogEntry)

Source from the content-addressed store, hash-verified

388
389// renderToolCard renders a tool call as a single styled line with icon and argument.
390func (l *LogViewer) renderToolCard(entry LogEntry) []string {
391 toolName := entry.Tool
392 if toolName == "" {
393 toolName = "unknown"
394 }
395
396 // Get icon and argument
397 icon := getToolIcon(toolName)
398 arg := getToolArgument(toolName, entry.ToolInput)
399
400 // Style the output
401 toolNameStyle := lipgloss.NewStyle().Foreground(PrimaryColor).Bold(true)
402 argStyle := lipgloss.NewStyle().Foreground(TextColor)
403
404 // Build the line: icon + tool name + argument
405 var line string
406 if arg != "" {
407 // Truncate argument if too long
408 maxArgLen := l.width - len(toolName) - 8
409 if maxArgLen > 0 && len(arg) > maxArgLen {
410 arg = arg[:maxArgLen-3] + "..."
411 }
412 line = fmt.Sprintf("%s %s %s", icon, toolNameStyle.Render(toolName), argStyle.Render(arg))
413 } else {
414 line = fmt.Sprintf("%s %s", icon, toolNameStyle.Render(toolName))
415 }
416
417 return []string{line}
418}
419
420// renderToolResult renders a tool result.
421func (l *LogViewer) renderToolResult(entry LogEntry) []string {

Callers 1

renderEntryMethod · 0.95

Calls 3

getToolIconFunction · 0.85
getToolArgumentFunction · 0.85
RenderMethod · 0.45

Tested by

no test coverage detected