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

Function generate_tool_call_id

src/tools/tool_executor.cpp:264–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262 std::string id = call_id.empty() ? generate_tool_call_id() : call_id;
263 return ToolCall(id, tool_name, arguments);
264}
265
266std::string generate_tool_call_id() {
267 // Generate a unique ID for tool calls
268 static std::random_device rd;
269 static std::mt19937 gen(rd());
270 static std::uniform_int_distribution<> dis(0, 15);
271
272 std::string id = "call_";
273 for (int i = 0; i < 24; ++i) {
274 int val = dis(gen);
275 if (val < 10) {
276 id += static_cast<char>('0' + val);
277 } else {
278 id += static_cast<char>('a' + val - 10);
279 }
280 }
281
282 return id;
283}
284

Callers 1

create_tool_callFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected