Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ const ToolFriendlyNameAndHandlers: { [K in ToolCall['toolName']]: [title: string
'report_intent': [l10n.t('Report Intent'), emptyInvocation, genericToolInvocationCompleted],
'think': [l10n.t('Thinking'), emptyInvocation, genericToolInvocationCompleted],
'report_progress': [l10n.t('Progress update'), formatProgressToolInvocation, genericToolInvocationCompleted],
'web_fetch': [l10n.t('Fetch Web Content'), emptyInvocation, genericToolInvocationCompleted],
'web_fetch': [l10n.t('Fetch Web Content'), formatWebFetchInvocation, genericToolInvocationCompleted],
'web_search': [l10n.t('Web Search'), emptyInvocation, genericToolInvocationCompleted],
'update_todo': [l10n.t('Update Todo'), formatUpdateTodoInvocation, formatUpdateTodoInvocationCompleted],
'show_file': [l10n.t('Show File'), formatShowFileInvocation, genericToolInvocationCompleted],
Expand Down Expand Up @@ -1101,6 +1101,15 @@ function formatProgressToolInvocation(invocation: ChatToolInvocationPart, toolCa



function formatWebFetchInvocation(invocation: ChatToolInvocationPart, toolCall: WebFetchTool): void {
const url = toolCall.arguments.url;
if (url) {
const displayUrl = url.length > 80 ? url.substring(0, 77) + '...' : url;
invocation.invocationMessage = l10n.t("Fetching {0}", displayUrl);
invocation.pastTenseMessage = l10n.t("Fetched {0}", displayUrl);
}
}

function formatViewToolInvocation(invocation: ChatToolInvocationPart, toolCall: ViewTool): void {
const args = toolCall.arguments;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,11 @@ describe('CopilotCLITools', () => {
const part = createCopilotCLIToolInvocation({ toolName: 'codeql_checker', toolCallId: 'cq1', arguments: {} });
expect(part).toBeInstanceOf(ChatToolInvocationPart);
});
it('formats web_fetch invocation with url', () => {
const part = createCopilotCLIToolInvocation({ toolName: 'web_fetch', toolCallId: 'wf1', arguments: { url: 'https://example.com/page' } });
expect(part).toBeInstanceOf(ChatToolInvocationPart);
expect(getInvocationMessageText(part as ChatToolInvocationPart)).toContain('https://example.com/page');
});
});

describe('process tool execution lifecycle', () => {
Expand Down
19 changes: 19 additions & 0 deletions src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ interface ICopilotGlobToolArgs {
path?: string;
}

/** Parameters for the `web_fetch` tool. */
interface ICopilotWebFetchToolArgs {
url: string;
}

/** Set of tool names that perform file edits. */
const EDIT_TOOL_NAMES: ReadonlySet<string> = new Set([
CopilotToolName.Edit,
Expand Down Expand Up @@ -245,6 +250,13 @@ export function getInvocationMessage(toolName: string, displayName: string, para
}
return localize('toolInvoke.glob', "Finding files");
}
case CopilotToolName.WebFetch: {
const args = parameters as ICopilotWebFetchToolArgs | undefined;
if (args?.url) {
return localize('toolInvoke.webFetch', "Fetching {0}", args.url);
}
return localize('toolInvoke.webFetchGeneric', "Fetching web content");
}
default:
return localize('toolInvoke.generic', "Using \"{0}\"", displayName);
}
Expand Down Expand Up @@ -300,6 +312,13 @@ export function getPastTenseMessage(toolName: string, displayName: string, param
}
return localize('toolComplete.glob', "Found files");
}
case CopilotToolName.WebFetch: {
const args = parameters as ICopilotWebFetchToolArgs | undefined;
if (args?.url) {
return localize('toolComplete.webFetch', "Fetched {0}", args.url);
}
return localize('toolComplete.webFetchGeneric', "Fetched web content");
}
default:
return localize('toolComplete.generic', "Used \"{0}\"", displayName);
}
Expand Down