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

Method execute_sync_tool

src/tools/tool_executor.cpp:134–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134ToolResult ToolExecutor::execute_sync_tool(
135 const ToolCall& tool_call,
136 const Tool& tool,
137 const ToolExecutionContext& context) {
138 if (!tool.execute) {
139 return ToolResult(tool_call.id, tool_call.tool_name, tool_call.arguments,
140 std::string("Tool has no synchronous execute function"));
141 }
142
143 try {
144 JsonValue result = tool.execute.value()(tool_call.arguments, context);
145 return ToolResult(tool_call.id, tool_call.tool_name, tool_call.arguments,
146 result);
147 } catch (const std::exception& e) {
148 return ToolResult(
149 tool_call.id, tool_call.tool_name, tool_call.arguments,
150 std::string("Tool execution failed: " + std::string(e.what())));
151 }
152}
153
154ToolResult ToolExecutor::execute_async_tool(
155 const ToolCall& tool_call,

Callers

nothing calls this directly

Calls 1

ToolResultClass · 0.85

Tested by

no test coverage detected