Enable tool call type coersion (#477)

* feat: enable tool call type coercion

* fix: tests for type coercion

---------

Co-authored-by: Mingholy <mingholy.lmh@gmail.com>
This commit is contained in:
Peter Stewart
2025-09-18 15:04:27 +10:00
committed by GitHub
parent 17cdce6298
commit 724c24933c
4 changed files with 36 additions and 23 deletions

View File

@@ -220,14 +220,12 @@ describe('WriteFileTool', () => {
);
});
it('should throw an error if the content is null', () => {
const dirAsFilePath = path.join(rootDir, 'a_directory');
fs.mkdirSync(dirAsFilePath);
it('should coerce null content into an empty string', () => {
const params = {
file_path: dirAsFilePath,
file_path: path.join(rootDir, 'test.txt'),
content: null,
} as unknown as WriteFileToolParams; // Intentionally non-conforming
expect(() => tool.build(params)).toThrow('params/content must be string');
expect(() => tool.build(params)).toBeDefined();
});
it('should throw error if the file_path is empty', () => {