Fix for validating getDescription in read_file tool call (#660)
This commit is contained in:
parent
c414512f19
commit
9dae07784b
|
@ -93,6 +93,13 @@ export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDescription(params: ReadFileToolParams): string {
|
getDescription(params: ReadFileToolParams): string {
|
||||||
|
if (
|
||||||
|
!params ||
|
||||||
|
typeof params.path !== 'string' ||
|
||||||
|
params.path.trim() === ''
|
||||||
|
) {
|
||||||
|
return `Path unavailable`;
|
||||||
|
}
|
||||||
const relativePath = makeRelative(params.path, this.rootDirectory);
|
const relativePath = makeRelative(params.path, this.rootDirectory);
|
||||||
return shortenPath(relativePath);
|
return shortenPath(relativePath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue