support for reading ./ paths (again?...)

This commit is contained in:
Nate 2025-09-06 20:17:59 -07:00
parent 1218c14f89
commit fa779a7f04

View file

@ -20,13 +20,17 @@ export const readFileTool: Tool = {
readonly: true,
isBuiltIn: true,
preprocess: async (args) => {
throwIfFileIsSecurityConcern(args.filepath);
let { filepath } = args;
if (filepath.startsWith("./")) {
filepath = filepath.slice(2);
}
throwIfFileIsSecurityConcern(filepath);
return {
args,
preview: [
{
type: "text",
content: `Will read ${formatToolArgument(args.filepath)}`,
content: `Will read ${formatToolArgument(filepath)}`,
},
],
};