diff --git a/src/AnthropicClient/Models/ToolResultContent.cs b/src/AnthropicClient/Models/ToolResultContent.cs
index 1ada98c..634ac87 100644
--- a/src/AnthropicClient/Models/ToolResultContent.cs
+++ b/src/AnthropicClient/Models/ToolResultContent.cs
@@ -23,6 +23,12 @@ public class ToolResultContent : Content
[JsonConstructor]
internal ToolResultContent() : base(ContentType.ToolResult) { }
+ private void Validate(string toolUseId, string content)
+ {
+ ArgumentValidator.ThrowIfNull(toolUseId, nameof(toolUseId));
+ ArgumentValidator.ThrowIfNull(content, nameof(content));
+ }
+
///
/// Initializes a new instance of the class.
///
@@ -32,10 +38,26 @@ public class ToolResultContent : Content
/// A new instance of the class.
public ToolResultContent(string toolUseId, string content) : base(ContentType.ToolResult)
{
- ArgumentValidator.ThrowIfNull(toolUseId, nameof(toolUseId));
- ArgumentValidator.ThrowIfNull(content, nameof(content));
+ Validate(toolUseId, content);
ToolUseId = toolUseId;
Content = content;
}
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The tool use ID of the content.
+ /// The content of the tool result.
+ /// The cache control to be used for the content.
+ /// Thrown when the tool use ID or content is null.
+ /// A new instance of the class.
+ public ToolResultContent(string toolUseId, string content, CacheControl cacheControl) : base(ContentType.ToolResult)
+ {
+ Validate(toolUseId, content);
+
+ ToolUseId = toolUseId;
+ Content = content;
+ CacheControl = cacheControl;
+ }
}
\ No newline at end of file