MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / nearest_tool_name

Function nearest_tool_name

src/tool_command/args.rs:459–466  ·  view source on GitHub ↗

Nearest tool name (short form) for unknown-tool suggestions.

(canonical: &str, defs: &[ToolDefinition])

Source from the content-addressed store, hash-verified

457
458/// Nearest tool name (short form) for unknown-tool suggestions.
459pub(crate) fn nearest_tool_name(canonical: &str, defs: &[ToolDefinition]) -> Option<String> {
460 let target = short_tool_name(canonical);
461 nearest_by_edit_distance(
462 target,
463 defs.iter()
464 .map(|def| short_tool_name(&def.name).to_string()),
465 )
466}
467
468/// Classic two-row Levenshtein distance; property and tool names are short so
469/// the quadratic cost is irrelevant.

Callers 2

runFunction · 0.85

Calls 2

short_tool_nameFunction · 0.85
nearest_by_edit_distanceFunction · 0.85