mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 21:12:57 -05:00
Merge pull request #10838 from dotCooCoo/fix/main-mcp-tool-schemas-nonempty
Main: guard the tool-name check in tool_schemas_are_valid
This commit is contained in:
1 file changed
+3
-1
@@ -229,10 +229,12 @@ fn initialize_negotiates_version() {
|
||||
#[test]
|
||||
fn tool_schemas_are_valid() {
|
||||
let tools = tool_definitions();
|
||||
assert!(!tools.is_empty(), "no tools defined");
|
||||
let mut names = std::collections::HashSet::new();
|
||||
for t in &tools {
|
||||
let name = t["name"].as_str().expect("name");
|
||||
assert!(!name.is_empty() && name.len() <= 64 && name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-'), "{name}");
|
||||
assert!(!name.is_empty(), "empty tool name");
|
||||
assert!(name.len() <= 64 && name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '-'), "{name}");
|
||||
assert!(names.insert(name), "duplicate tool {name}");
|
||||
assert!(t["description"].as_str().is_some_and(|d| d.len() > 10), "{name} description");
|
||||
let schema = &t["inputSchema"];
|
||||
|
||||
Reference in new issue
Block a user