Skip to content

Commit 65fe040

Browse files
committed
Fix incorrect tool encoding
1 parent 6ac86fa commit 65fe040

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Sources/AnthropicSwiftSDK/Entity/Tool/Tool.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,17 @@ public enum Tool {
5656
case function(FunctionTool)
5757
}
5858

59-
extension Tool: Encodable {}
59+
extension Tool: Encodable {
60+
public func encode(to encoder: any Encoder) throws {
61+
switch self {
62+
case .computer(let tool):
63+
try tool.encode(to: encoder)
64+
case .textEditor(let tool):
65+
try tool.encode(to: encoder)
66+
case .bash(let tool):
67+
try tool.encode(to: encoder)
68+
case .function(let tool):
69+
try tool.encode(to: encoder)
70+
}
71+
}
72+
}

0 commit comments

Comments
 (0)