This commit is contained in:
seb
2026-10-07 19:16:42 +02:00
parent 1743cef11c
commit 857963b1c3
20 changed files with 892 additions and 182 deletions

View File

@@ -75,12 +75,12 @@ export function createReadFileTool({ googleAuthId }) {
description: 'VFS file path.',
},
seek: {
type: 'number',
description: 'Line offset (0-indexed). Default 0.',
type: ['number', 'null'],
description: 'Line offset (0-indexed) or null. Default 0.',
},
limit: {
type: 'number',
description: `Max lines to return. Default ${DEFAULT_LIMIT}, max ${MAX_LIMIT}.`,
type: ['number', 'null'],
description: `Max lines to return or null. Default ${DEFAULT_LIMIT}, max ${MAX_LIMIT}.`,
},
},
},
@@ -88,9 +88,11 @@ export function createReadFileTool({ googleAuthId }) {
if (typeof filename !== 'string' || !filename.trim()) {
throw new ToolError('"filename" must be a non-empty string.');
}
seek = seek != null ? Number(seek) : 0;
if (!Number.isInteger(seek) || seek < 0) {
throw new ToolError(`"seek" must be a non-negative integer (received ${seek}).`);
}
limit = limit != null ? Number(limit) : DEFAULT_LIMIT;
if (!Number.isInteger(limit) || limit < 1) {
throw new ToolError(`"limit" must be a positive integer (received ${limit}).`);
}