Interface IChatToolRenderer
The seam through which an application renders its own tools.
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public interface IChatToolRenderer
Remarks
ChatMessages knows how to lay a conversation out, but not what any particular tool call should look like — that is a product decision, and the registry keeps it in a separate renderer registry. Implement this and hand it to toolRenderer to place bespoke content under the activity timeline. Returning null falls back to the timeline row alone, which is what happens when no renderer is set.
Examples
class DiffToolRenderer : IChatToolRenderer
{
public VisualElement CreateToolContent(ChatMessagePart call, object result)
{
if (call.toolName != "apply_patch")
return null;
return new CodeBlock { language = "diff", code = result as string };
}
}
Methods
CreateToolContent(ChatMessagePart, object)
Builds the content shown for one tool call, or returns null to render nothing extra.
Declaration
VisualElement CreateToolContent(ChatMessagePart call, object result)
Parameters
| Type | Name | Description |
|---|---|---|
| ChatMessagePart | call | The ToolCall part. |
| object | result | What the matching result carried, or null while the call is pending. |
Returns
| Type | Description |
|---|---|
| VisualElement | The element to insert, or null. |