Don't enforce leading slash since that's not true on Windows (#3545)

This commit is contained in:
Tommaso Sciortino 2025-07-08 09:30:49 -07:00 committed by GitHub
parent 4dab31f1c8
commit 5c759d48c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -74,7 +74,7 @@ describe('ReadFileTool', () => {
it('should return error for relative path', () => {
const params: ReadFileToolParams = { absolute_path: 'test.txt' };
expect(tool.validateToolParams(params)).toBe(
`params/absolute_path must match pattern "^/"`,
`File path must be absolute, but was relative: test.txt. You must provide an absolute path.`,
);
});
@ -144,10 +144,10 @@ describe('ReadFileTool', () => {
const params: ReadFileToolParams = { absolute_path: 'relative/path.txt' };
const result = await tool.execute(params, abortSignal);
expect(result.llmContent).toBe(
'Error: Invalid parameters provided. Reason: params/absolute_path must match pattern "^/"',
'Error: Invalid parameters provided. Reason: File path must be absolute, but was relative: relative/path.txt. You must provide an absolute path.',
);
expect(result.returnDisplay).toBe(
'params/absolute_path must match pattern "^/"',
'File path must be absolute, but was relative: relative/path.txt. You must provide an absolute path.',
);
});

View File

@ -60,7 +60,6 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
description:
"The absolute path to the file to read (e.g., '/home/user/project/file.txt'). Relative paths are not supported. You must provide an absolute path.",
type: Type.STRING,
pattern: '^/',
},
offset: {
description: