:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { LemonTag } from '@posthog/lemon-ui'
import type { AggregatedToolCall } from './llmPlaygroundRunLogic'
function formatArguments(args: string): string {
try {
return JSON.stringify(JSON.parse(args), null, 2)
} catch {
// Streamed arguments can be a partial JSON string until the chunks finish.
return args
}
}
/** Read-only card for a tool call the model issued, shown in the result panel. */
export function ToolCallDisplay({ toolCall }: { toolCall: AggregatedToolCall }): JSX.Element {
return (
<div className="border rounded p-2 bg-surface-primary">
<div className="flex items-center gap-2 mb-1">
<LemonTag type="default" size="small">
Tool call
</LemonTag>
<span className="font-mono text-xs font-semibold">{toolCall.name || '…'}</span>
<span className="font-mono text-xs text-muted truncate">{toolCall.id}</span>
</div>
<pre className="text-xs whitespace-pre-wrap break-words m-0 font-mono">
{formatArguments(toolCall.arguments)}
</pre>
</div>
)
}