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

Function lookup_user

examples/langfuse_tracing.cpp:32–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32ai::JsonValue lookup_user(const ai::JsonValue& args,
33 const ai::ToolExecutionContext&) {
34 static const std::map<std::string, ai::JsonValue> users = {
35 {"alice", {{"name", "Alice"}, {"city", "San Francisco"}}},
36 {"bob", {{"name", "Bob"}, {"city", "New York"}}},
37 };
38 auto id = args.value("user_id", std::string{});
39 auto it = users.find(id);
40 if (it != users.end())
41 return it->second;
42 return ai::JsonValue{{"error", "user not found"}};
43}
44
45ai::JsonValue get_weather(const ai::JsonValue& args,
46 const ai::ToolExecutionContext&) {

Callers

nothing calls this directly

Calls 1

endMethod · 0.45

Tested by

no test coverage detected