-
Notifications
You must be signed in to change notification settings - Fork 8.3k
everything: zip tool: add outputType to control resource vs. resource link output #2831
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How has this been tested? The Everything server doesn't have any file resources and if I try giving it a Resource URI it fails.
I tried fetch with a file url and Node v23.11.1 throws error, whether I included "file:///" or not:
TypeError: fetch failed
at node:internal/deps/undici/undici:13510:13
[cause]: Error: not implemented... yet...
When I ask Google about that, I get
The error TypeError: fetch failed with the cause Error: not implemented... yet... occurs because the fetch() function in Node.js does not support the file:// protocol for reading from the local file system.
The fetch() function is designed primarily for making network requests using protocols like http:// and https://.
To solve this issue, you must use Node.js's built-in File System (fs) module instead of fetch().
Seems like there might be at minimum a need to rewrite using fs
.
import { readFile } from 'node:fs/promises';
async function useReadFile() {
try {
const filePath = '/Users/zaphod/question.txt';
const fileContent = await readFile(filePath');
console.log('File content:', fileContent);
} catch (error) {
console.error('Error reading file:', error);
}
}
The Everything server doesn't have any resources that are files, so what is this tool supposed to fetch?
I'm worried that either implementation would allow fetching of arbitrary files.
Please do some testing and show your work so that we can duplicate it when testing on our side.
if (name === ToolName.ZIP_RESOURCES) { | ||
const { files } = ZipResourcesInputSchema.parse(args); | ||
|
||
const { files, outputType } = ZipResourcesInputSchema.parse(args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be some validation that the files are within roots or are valid resources? If I asked for /etc/passwd
would it zip up and return it?
Follow up on #2830
Add outputType input:
cc/ @crondinini-ant