use mcp_vol::{Bm25Ranker, Catalog, EvalCase, EvalSuite};
fn main() {
let catalog = Catalog::from_mcp_json(
r#"{
"tools": [
{
"name": "search_code",
"description": "Searches source code files by symbol or regex pattern.",
"inputSchema": { "type": "object", "properties": { "query": { "type": "string", "description": "Search pattern." } } }
},
{
"name": "list_commits",
"description": "Lists recent git commits for a branch with author and timestamp metadata.",
"inputSchema": { "type": "object", "properties": { "branch": { "type": "string", "description": "Git branch name." } } }
}
]
}"#,
)
.expect("valid catalog");
let suite = EvalSuite::new([
EvalCase {
id: "code".into(),
query: "find where Bm25Ranker is defined in source code".into(),
expected_tool: "search_code".into(),
acceptable_tools: vec![],
},
EvalCase {
id: "history".into(),
query: "show recent git commit history on main branch".into(),
expected_tool: "list_commits".into(),
acceptable_tools: vec![],
},
]);
let report = suite.run(&catalog, &Bm25Ranker::default(), 3);
println!("{}", report.to_text());
}