Skip to content

MCP tool results for large files are silently truncated with a vscode-chat-response-resource:// hint that does not work #311068

@mikejohnstonPremierinc

Description

@mikejohnstonPremierinc

Description

When a GitHub MCP get_file_contents tool call returns a large file (50KB–999KB, under the MCP server's 1MB hard limit), VS Code's context window manager truncates the tool result before it reaches the LLM and marks the response isTruncated=true.

VS Code then displays the following hint to the agent/user:

"you can read the full contents of any truncated resources by passing their URIs as the absolutePath to the read_file tool"

The hint provides a vscode-chat-response-resource:// URI. However, passing this URI to read_file (VS Code's built-in file reading tool) does not work. It returns:

"File is outside of the workspace, and not open in an editor, and can't be read."

The hint instructs a recovery action that is impossible to perform. This causes AI agents to enter a confused state where they have been told a recovery path exists, attempt it, fail, and have no clear way forward.

Steps to Reproduce

  1. Open VS Code with the GitHub MCP server configured
  2. In Copilot Chat, use the get_file_contents tool to fetch a file between 50KB and 999KB from a GitHub repository (e.g., a large C# utility file ~120KB)
  3. Observe that VS Code truncates the result and marks it isTruncated=true
  4. Observe the hint displayed: "you can read the full contents of any truncated resources by passing their URIs as the absolutePath to the read_file tool" along with a vscode-chat-response-resource://... URI
  5. Attempt to call read_file with that URI as the absolutePath parameter
  6. Observe the error: "File is outside of the workspace, and not open in an editor, and can't be read."

Reproduction files used:

  • PQA_Training_Services.cs (~120KB) from PremierInc/pqa-browser-base-framework
  • Browser.Base.Framework.xml (~233KB) from same repo

Both triggered the truncation + broken hint on the same session.

Expected Behavior

Either:

  • (a) The vscode-chat-response-resource:// URI is readable via read_file, allowing the agent to retrieve the full content as the hint promises, OR
  • (b) The hint is removed entirely and replaced with an honest message such as: "This file is too large to include in full. Use search_code with specific search terms to find the content you need."

Actual Behavior

The hint is displayed but the suggested action is impossible. read_file with the URI returns an error. The agent has no actionable recovery path from the hint.

Additional Context

Copilot Chat Extension Version

  • VS Code Version: 1.116.0
  • OS Version: Windows_NT x64 10.0.26200
  • Feature (e.g. agent/edit/ask mode): agent/ask
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): Claude Opus
  • Logs:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions