Skip to main content

allowed_tool_count

Function allowed_tool_count 

Source
pub fn allowed_tool_count(allowed_tools: &str) -> usize
Expand description

Count the space-delimited tools in an allowed-tools value.

This is how MAX_ALLOWED_TOOLS is measured, so it lives next to the limit rather than being re-derived by each validator. Counting the iterator avoids materializing a Vec that would only be read for its length.

ยงExamples

use vtcode_skills::limits::allowed_tool_count;

assert_eq!(allowed_tool_count("Read Write Bash"), 3);
assert_eq!(allowed_tool_count("  Read   Write  "), 2);
assert_eq!(allowed_tool_count(""), 0);