MCPcopy Create free account
hub / github.com/AI45Lab/Code / respects_result_limit

Function respects_result_limit

core/src/context/static_provider.rs:117–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115
116 #[tokio::test]
117 async fn respects_result_limit() {
118 let provider = StaticContextProvider::from_items(
119 "static",
120 [
121 ContextItem::new("a", ContextType::Resource, "a").with_token_count(1),
122 ContextItem::new("b", ContextType::Resource, "b").with_token_count(1),
123 ],
124 );
125
126 let result = provider
127 .query(&ContextQuery::new("prompt").with_max_results(1))
128 .await
129 .unwrap();
130
131 assert_eq!(result.items.len(), 1);
132 assert!(result.truncated);
133 }
134
135 #[tokio::test]
136 async fn truncates_oversized_single_item() {

Callers

nothing calls this directly

Calls 3

with_token_countMethod · 0.80
with_max_resultsMethod · 0.80
queryMethod · 0.45

Tested by

no test coverage detected