2951
export namespace ChatToolInvocationPart {
2952
export function from(part: vscode.ChatToolInvocationPart): IChatToolInvocationSerialized | IChatExternalToolInvocationUpdate {
2954
>
// If so, convert to resultDetails for rendering via ChatInputOutputMarkdownProgressPart
2955
>
let resultDetails: IToolResultInputOutputDetails | undefined;
2956
>
let toolSpecificData: any;
2957
>
2958
>
if (part.toolSpecificData && isChatMcpToolInvocationData(part.toolSpecificData)) {
2959
// Convert ChatMcpToolInvocationData to IToolResultInputOutputDetails
2960
resultDetails = convertMcpToResultDetails(part.toolSpecificData, part.isError);
2961
toolSpecificData = undefined; // MCP data goes to resultDetails, not toolSpecificData
2963
>
toolSpecificData = part.toolSpecificData ? convertToolSpecificData(part.toolSpecificData) : undefined;
2964
>
}
2965
>
2966
>
const presentation = part.presentation === 'hidden'
2967
? ToolInvocationPresentation.Hidden
2969
? ToolInvocationPresentation.HiddenAfterComplete
2971
>
2972
>
// When isComplete is explicitly set (not undefined), use the update DTO to enable
2973
>
// live tool invocation updates. Extensions can push with isComplete: false to start
2974
>
// an in-progress invocation, then push again with isComplete: true to complete it.
2975
>
if (part.enablePartialUpdate) {
2976
return {
2977
kind: 'externalToolInvocationUpdate',