-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Fix fetch tool to fallback to file service for non-http schemes #252683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This prevents MCP resource URIs (like test://static/resource/50) from being incorrectly processed by the fetch tool. MCP resources should be handled by VS Code's filesystem providers instead. - Modified FetchWebPageTool._parseUris() to filter out non-HTTP(S) schemes - Added comprehensive tests for the new scheme filtering behavior - Non-HTTP(S) URIs will now be treated as invalid and skipped Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
I'd rather the tests implemented a TestWebContentExtractorService which can be constructed with a map of like "Uris to fake page contents" and then have tests that test the actual API not private methods |
…ng private methods Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
I've refactored the tests to use a TestWebContentExtractorService that implements IWebContentExtractorService with configurable URI-to-content mapping. The tests now validate the public API behavior (via the Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
I think what would be nice here is actually to just serve the file data if it's something the IFileService can resolve. Sure it might not be 'correct' use of the fetch tool, but that would make usages of it not break :) |
…P schemes Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com>
I've implemented your suggestion to serve file data via IFileService for non-HTTP/HTTPS schemes. The fetch tool now:
This makes MCP resources work seamlessly - instead of rejecting Commit: 2df3c81 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
I like the strategy of:
However, let's not change the description of the tool as I don't want this fall back to be used too heavily over other read tools. And remember order matters in what you return back so maintain the same order in the response. |
Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
I've reverted the tool description back to the original text that only mentions web pages, while keeping the file service fallback functionality intact. The tool maintains proper URL order in responses as requested. Commit: 9c36f75 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Can you use this FileService implementation as the implementation on the web? Right now that's using the Null one |
Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com>
I've implemented a FileService-based WebContentExtractorService for the web platform. The web workbench now uses |
) * Initial plan * Fix fetch tool to only handle HTTP/HTTPS schemes This prevents MCP resource URIs (like test://static/resource/50) from being incorrectly processed by the fetch tool. MCP resources should be handled by VS Code's filesystem providers instead. - Modified FetchWebPageTool._parseUris() to filter out non-HTTP(S) schemes - Added comprehensive tests for the new scheme filtering behavior - Non-HTTP(S) URIs will now be treated as invalid and skipped Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> * Refactor tests to use TestWebContentExtractorService instead of testing private methods Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> * Enhance fetch tool to serve file content via IFileService for non-HTTP schemes Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com> * Revert tool description to original text as requested Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> * Implement FileService-based WebContentExtractorService for web platform Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> * Handle binary data * style * don't adopt this yet --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> Co-authored-by: connor4312 <2230985+connor4312@users.noreply.github.com> Co-authored-by: Tyler Leonhardt <tyleonha@microsoft.com>
Fixes #250495