Property ArgumentsJson
ArgumentsJson
Gets the JSON arguments to pass to the tool.
public string ArgumentsJson { get; }
Property Value
- string
A JSON object string containing the arguments for the tool invocation. Guaranteed to be valid JSON (at minimum
"{}").
Examples
Example: Invoking a tool with its arguments
if (registry.TryGet(toolCall.Name, out ITool tool))
{
try
{
string resultJson = await tool.InvokeAsync(
toolCall.ArgumentsJson,
cancellationToken);
Console.WriteLine($"Tool returned: {resultJson}");
}
catch (Exception ex)
{
Console.WriteLine($"Tool error: {ex.Message}");
}
}
Remarks
Pass this string directly to InvokeAsync(string, CancellationToken). The JSON structure should conform to the tool's InputSchema.
If the model's output was blank or whitespace, this property is normalized to
"{}" (empty object) to ensure valid JSON.