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

Method execute_async_tool

src/tools/tool_executor.cpp:154–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154ToolResult ToolExecutor::execute_async_tool(
155 const ToolCall& tool_call,
156 const Tool& tool,
157 const ToolExecutionContext& context) {
158 if (!tool.execute_async) {
159 return ToolResult(tool_call.id, tool_call.tool_name, tool_call.arguments,
160 std::string("Tool has no asynchronous execute function"));
161 }
162
163 try {
164 auto future = tool.execute_async.value()(tool_call.arguments, context);
165 JsonValue result = future.get(); // Wait for completion
166 return ToolResult(tool_call.id, tool_call.tool_name, tool_call.arguments,
167 result);
168 } catch (const std::exception& e) {
169 return ToolResult(
170 tool_call.id, tool_call.tool_name, tool_call.arguments,
171 std::string("Async tool execution failed: " + std::string(e.what())));
172 }
173}
174
175bool ToolExecutor::validate_json_schema(const JsonValue& data,
176 const JsonValue& schema) {

Callers

nothing calls this directly

Calls 1

ToolResultClass · 0.85

Tested by

no test coverage detected