Fix for validating getDescription in read_file tool call (#660)

This commit is contained in:
anj-s 2025-06-01 00:02:00 -07:00 committed by GitHub
parent c414512f19
commit 9dae07784b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -93,6 +93,13 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
}
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);
}