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

Function test_build_request_with_tools

core/src/llm/anthropic.rs:791–805  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

789
790 #[test]
791 fn test_build_request_with_tools() {
792 let client = make_client();
793 let messages = vec![Message::user("Use a tool")];
794 let tools = vec![ToolDefinition {
795 name: "read_file".to_string(),
796 description: "Read a file".to_string(),
797 parameters: serde_json::json!({"type": "object", "properties": {}}),
798 }];
799 let req = client.build_request(&messages, None, &tools);
800
801 assert!(req["tools"].is_array());
802 assert_eq!(req["tools"][0]["name"], "read_file");
803 // Last tool should have cache_control
804 assert!(req["tools"][0]["cache_control"].is_object());
805 }
806
807 #[test]
808 fn test_build_request_thinking_budget_sets_max_tokens() {

Callers

nothing calls this directly

Calls 2

build_requestMethod · 0.80
make_clientFunction · 0.70

Tested by

no test coverage detected