MCPcopy Create free account
hub / github.com/ClickHouse/ai-sdk-cpp / lookup_user

Function lookup_user

examples/tool_calling_multistep.cpp:41–53  ·  view source on GitHub ↗

Tool: Look up user information

Source from the content-addressed store, hash-verified

39
40// Tool: Look up user information
41ai::JsonValue lookup_user(const ai::JsonValue& args,
42 const ai::ToolExecutionContext& context) {
43 std::string user_id = args["user_id"].get<std::string>();
44
45 std::cout << "🔍 Looking up user: " << user_id << std::endl;
46
47 auto it = user_database.find(user_id);
48 if (it != user_database.end()) {
49 return it->second;
50 } else {
51 return ai::JsonValue{{"error", "User not found"}};
52 }
53}
54
55// Tool: Get weather for a location
56ai::JsonValue get_weather(const ai::JsonValue& args,

Callers

nothing calls this directly

Calls 1

endMethod · 0.45

Tested by

no test coverage detected