use crate::color; use crate::section::{RenderContext, SectionOutput}; pub fn render(ctx: &RenderContext) -> Option { if !ctx.config.sections.tools.base.enabled { return None; } let cost = ctx.input.cost.as_ref()?; let count = cost.total_tool_uses.unwrap_or(0); if count == 0 { return None; } let last = if ctx.config.sections.tools.show_last_name { cost.last_tool_name .as_deref() .map(|n| format!(" ({n})")) .unwrap_or_default() } else { String::new() }; let raw = format!("{count} tools{last}"); let ansi = if ctx.color_enabled { format!("{}{raw}{}", color::DIM, color::RESET) } else { raw.clone() }; Some(SectionOutput { raw, ansi }) }