fix: add parameter validation to all tools to prevent undefined insertions (#14)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-10-27 16:25:33 -07:00
committed by GitHub
parent 43483c77a5
commit 78ddbd499d
21 changed files with 194 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { promises as fs } from "node:fs";
import * as path from "node:path";
import { validateRequiredParams } from "./validation.js";
interface ReadArgs {
file_path: string;
@@ -79,6 +80,7 @@ function formatWithLineNumbers(
}
export async function read(args: ReadArgs): Promise<ReadResult> {
validateRequiredParams(args, ["file_path"], "Read");
const { file_path, offset, limit } = args;
if (!path.isAbsolute(file_path))
throw new Error(`File path must be absolute, got: ${file_path}`);