Skip to content
docsv0.2.0

ChannelRendererInterface

Interface for channel-specific renderers. Each channel (Telegram, CLI, Web) has its own renderer that transforms ToolResult into the appropriate format for that channel.

ChannelRendererInterface::supports()

abstract public function supports(string $channel): bool

Check if this renderer supports the given channel.

Parameters

Parameters of supports()
NameTypeDescription
$channelstring

ChannelRendererInterface::render()

abstract public function render(Milpa\ToolRuntime\ToolResult $result, ?Milpa\ToolRuntime\Contracts\ToolContext $ctx = null): ?mixed

Render the ToolResult for the specific channel.

Parameters

Parameters of render()
NameTypeDescription
$resultToolResultThe structured result to render
$ctx(ToolContext | null)The execution context

Returns

Channel-specific output (string, array, etc.)