MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / extract_tool_detail

Function extract_tool_detail

atomic-agent/src/transcript/condense.rs:297–318  ·  view source on GitHub ↗

Extract appropriate detail for a tool call. For minimal-detail tools (Read, Skill, WebFetch), returns only the essential identifier (path, skill name, URL). For other tools, returns the most relevant field from the input.

(tool_name: &str, input: &serde_json::Value)

Source from the content-addressed store, hash-verified

295/// essential identifier (path, skill name, URL). For other tools, returns
296/// the most relevant field from the input.
297fn extract_tool_detail(tool_name: &str, input: &serde_json::Value) -> Option<String> {
298 let parsed: ToolInput = serde_json::from_value(input.clone()).unwrap_or_default();
299
300 // Minimal detail tools — show only the identifier
301 if MINIMAL_DETAIL_TOOLS.contains(&tool_name) {
302 return match tool_name {
303 "Skill" => parsed.skill,
304 "Read" => parsed.file_path.or(parsed.notebook_path),
305 "WebFetch" => parsed.url,
306 _ => None,
307 };
308 }
309
310 // Other tools — use the most relevant field
311 parsed
312 .description
313 .or(parsed.command)
314 .or_else(|| parsed.args.as_ref().map(|a| a.join(" ")))
315 .or(parsed.file_path)
316 .or(parsed.notebook_path)
317 .or(parsed.pattern)
318}

Callers 1

Calls 3

as_refMethod · 0.80
cloneMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected