summaryrefslogtreecommitdiff
path: root/packages/core/src
diff options
context:
space:
mode:
authoranj-s <[email protected]>2025-06-01 00:02:00 -0700
committerGitHub <[email protected]>2025-06-01 00:02:00 -0700
commit9dae07784b82e9cc3306fa146de2956d574daa2d (patch)
treef91807ba7fd6d6b1e8ee103dd6822dc5cb9deadc /packages/core/src
parentc414512f1999b48a0dc02fed14e793b650907ba8 (diff)
Fix for validating getDescription in read_file tool call (#660)
Diffstat (limited to 'packages/core/src')
-rw-r--r--packages/core/src/tools/read-file.ts7
1 files changed, 7 insertions, 0 deletions
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<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);
}