Don't enforce leading slash since that's not true on Windows (#3545)
This commit is contained in:
parent
4dab31f1c8
commit
5c759d48c7
|
@ -74,7 +74,7 @@ describe('ReadFileTool', () => {
|
||||||
it('should return error for relative path', () => {
|
it('should return error for relative path', () => {
|
||||||
const params: ReadFileToolParams = { absolute_path: 'test.txt' };
|
const params: ReadFileToolParams = { absolute_path: 'test.txt' };
|
||||||
expect(tool.validateToolParams(params)).toBe(
|
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 params: ReadFileToolParams = { absolute_path: 'relative/path.txt' };
|
||||||
const result = await tool.execute(params, abortSignal);
|
const result = await tool.execute(params, abortSignal);
|
||||||
expect(result.llmContent).toBe(
|
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(
|
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.',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
|
||||||
description:
|
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.",
|
"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,
|
type: Type.STRING,
|
||||||
pattern: '^/',
|
|
||||||
},
|
},
|
||||||
offset: {
|
offset: {
|
||||||
description:
|
description:
|
||||||
|
|
Loading…
Reference in New Issue