Skip to content

Commit ff54fb6

Browse files
Fix/mcp tools deserialization (#64)
* fix: use native SSL on macOS/Windows, remove OpenSSL dependency - macOS: Use SecureTransport (via Security framework) - Windows: Use WinSSL/Schannel (via crypt32) - Remove OpenSSL requirement for faster compilation - Smaller binaries and better OS security integration * fix: properly deserialize MCP tools from extensions in ResponsesRequest - Fix tools being cleared but not re-added from extensions - Convert JSON tools array to ToolVariant vector correctly - Properly deserialize McpTool from JSON in ResponsesRequest::fromLLMRequest This ensures MCP tools are properly included in API requests to OpenAI
1 parent 7e80e8e commit ff54fb6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/openai/OpenAITypes.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,18 @@ ResponsesRequest ResponsesRequest::fromLLMRequest(const LLMRequest& request) {
7171
// Handle tools from extensions (if present)
7272
if (hasTools(request.config)) {
7373
json toolsJson = getToolsJson(request.config);
74-
// Tools are stored as JSON - we need to deserialize them into ToolVariant
75-
// For now, we'll parse them on a best-effort basis
76-
// TODO: Implement proper tool deserialization
77-
responsesReq.tools.clear(); // Clear any existing tools
74+
responsesReq.tools.clear();
75+
76+
// Convert JSON tools array to ToolVariant vector
77+
for (const auto& toolJson : toolsJson) {
78+
if (toolJson.contains("type")) {
79+
std::string toolType = toolJson["type"].get<std::string>();
80+
if (toolType == "mcp") {
81+
McpTool mcpTool = McpTool::fromJson(toolJson);
82+
responsesReq.tools.push_back(mcpTool);
83+
}
84+
}
85+
}
7886
}
7987

8088
// Handle JSON schema for structured outputs

0 commit comments

Comments
 (0)