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

Function test_anthropic_build_request_with_tools

core/src/llm/tests.rs:894–909  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

892
893 #[test]
894 fn test_anthropic_build_request_with_tools() {
895 let client =
896 AnthropicClient::new("key".to_string(), "claude-sonnet-4-20250514".to_string());
897 let msgs = vec![Message::user("Hello")];
898 let tools = vec![ToolDefinition {
899 name: "bash".to_string(),
900 description: "Run a command".to_string(),
901 parameters: serde_json::json!({"type": "object", "properties": {"command": {"type": "string"}}}),
902 }];
903 let req = client.build_request(&msgs, None, &tools);
904
905 assert!(req["tools"].is_array());
906 assert_eq!(req["tools"][0]["name"], "bash");
907 assert_eq!(req["tools"][0]["description"], "Run a command");
908 assert!(req["tools"][0]["input_schema"].is_object());
909 }
910
911 #[test]
912 fn test_anthropic_build_request_max_tokens() {

Callers

nothing calls this directly

Calls 1

build_requestMethod · 0.80

Tested by

no test coverage detected