diff --git a/packages/core/src/tools/read-file.ts b/packages/core/src/tools/read-file.ts index 4bb3bd56..f92885ea 100644 --- a/packages/core/src/tools/read-file.ts +++ b/packages/core/src/tools/read-file.ts @@ -93,6 +93,13 @@ export class ReadFileTool extends BaseTool { } getDescription(params: ReadFileToolParams): string { + if ( + !params || + typeof params.path !== 'string' || + params.path.trim() === '' + ) { + return `Path unavailable`; + } const relativePath = makeRelative(params.path, this.rootDirectory); return shortenPath(relativePath); }