Skip to content

agentHost: make file paths in tool invocation messages nicer#310813

Merged
connor4312 merged 1 commit intomainfrom
connor4312/read-file-display
Apr 16, 2026
Merged

agentHost: make file paths in tool invocation messages nicer#310813
connor4312 merged 1 commit intomainfrom
connor4312/read-file-display

Conversation

@connor4312
Copy link
Copy Markdown
Member

Does proper markdown linking

Copilot AI review requested due to automatic review settings April 16, 2026 17:53
@connor4312 connor4312 enabled auto-merge (squash) April 16, 2026 17:53
@connor4312 connor4312 self-assigned this Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: d60ffdc8 Current: 5f804b22

Changed (2)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Light
Before After
before after

* as a clickable file widget in the chat UI.
*/
function formatPathAsMarkdownLink(path: string): string {
return `[](${URI.file(path).toString()})`;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be on the client side, not the agent host

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Agent Host/Copilot tool messaging to support richer rendering (notably file “pills” via markdown links) and consolidates permission-request display logic alongside existing tool display helpers.

Changes:

  • Switch tool invocation/past-tense messages to return StringOrMarkdown and render file paths as [](file://...) links for clickable file widgets.
  • Move/centralize SDK permission request display derivation into copilotToolDisplay.ts (including typed request helpers).
  • Update IAgentToolStartEvent.invocationMessage to StringOrMarkdown to align with protocol/tool UI rendering.
Show a summary per file
File Description
src/vs/platform/agentHost/node/copilot/copilotToolDisplay.ts Adds markdown-link formatting for file paths; returns StringOrMarkdown; introduces permission display helpers.
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Consumes the new permission display helper and propagates permissionPath from it.
src/vs/platform/agentHost/common/agentService.ts Changes tool_start invocationMessage type to StringOrMarkdown.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 1

Comment on lines +470 to +472
return {
confirmationTitle: serverName ? `${serverName}: ${title}` : title,
invocationMessage: serverName ? `${serverName}: ${title}` : title,
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MCP permission title/message is built with a template literal (e.g. ${serverName}: ${title}), which bypasses localization and violates the repo’s pattern of using localize() with placeholders for user-facing strings. Please format this via a localized string (e.g. localize('…', "{0}: {1}", serverName, title)) and reuse it for both confirmationTitle and invocationMessage to keep them consistent.

Suggested change
return {
confirmationTitle: serverName ? `${serverName}: ${title}` : title,
invocationMessage: serverName ? `${serverName}: ${title}` : title,
const message = serverName ? localize('copilot.permission.mcp.serverAndTool', "{0}: {1}", serverName, title) : title;
return {
confirmationTitle: message,
invocationMessage: message,

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment

@connor4312 connor4312 merged commit 2c6e38b into main Apr 16, 2026
30 checks passed
@connor4312 connor4312 deleted the connor4312/read-file-display branch April 16, 2026 18:14
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 16, 2026
Copy link
Copy Markdown

@otbotb371-lgtm otbotb371-lgtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants