615
}
616
if (params.item.type === 'dynamicToolCall') {
618
>
const toolName = params.item.namespace ? `${params.item.namespace}.${params.item.tool}` : params.item.tool;
619
>
const toolInput = toolInputText(params.item.arguments);
620
>
const output = dynamicToolOutput(params.item.contentItems);
621
>
// Server tools (registered under their bare name) execute in-process, so
622
>
// they carry no `Client` contributor; only client-provided tools route
623
>
// execution back to the owning workbench client.
624
>
const isServerTool = params.item.namespace === null && state.serverToolNames.has(params.item.tool);
625
>
const ownerClientId = isServerTool ? undefined : state.clientToolSet.ownerOf(params.item.tool);
626
>
const serverDisplay = getServerToolDisplay(params.item.tool, params.item.arguments);
627
>
state.itemToToolCall.set(params.item.id, {
628
>
toolCallId,
629
>
turnId: params.turnId,
630
>
toolName,
631
>
output,
632
>
});
633
>
return [
634
>
{
635
>
type: ActionType.ChatToolCallStart,
636
>
turnId: params.turnId,
637
>
toolCallId,
638
>
toolName,
639
>
displayName: serverDisplay?.displayName ?? params.item.tool,
640
>
...(ownerClientId ? { contributor: { kind: ToolCallContributorKind.Client, clientId: ownerClientId } } : {}),
641
>
},
642
>
{
643
>
type: ActionType.ChatToolCallDelta,
644
>
turnId: params.turnId,
645
>
toolCallId,
646
>
content: toolInput,
647
>
},
648
>
{
649
>
type: ActionType.ChatToolCallReady,
650
>
turnId: params.turnId,
651
>
toolCallId,
652
>
invocationMessage: serverDisplay?.invocationMessage ?? `Calling ${toolName}`,
653
>
toolInput,
654
>
confirmed: ToolCallConfirmationReason.NotNeeded,
655
>
},
656
>
...(output ? [{
657
type: ActionType.ChatToolCallContentChanged,
658
turnId: params.turnId,
659
toolCallId,
660
content: [{ type: ToolResultContentType.Text, text: output }],
662
>
];
663
>
}
664
if (params.item.type === 'collabAgentToolCall') {
665
const toolCallId = generateUuid();