feat: guard de schemas de tablas en las file tools (redirige a las table tools)

This commit is contained in:
Jordan Diaz
2026-07-25 16:12:46 +00:00
parent 6dfedd07fc
commit 5e61124c65
4 changed files with 69 additions and 4 deletions

View File

@@ -1,7 +1,12 @@
import { z } from "zod";
import { handleToolError, validateRequired } from "../helpers/errorHandler.js";
import { getCurrentProjectInfo, callLocalFileEndpoint, buildLocalFileErrorResponse } from "./helpers.js";
import { isProtectedLayoutPath, buildProtectedLayoutPathError } from "./protectedPaths.js";
import {
isProtectedLayoutPath,
buildProtectedLayoutPathError,
isProtectedSchemaPath,
buildProtectedSchemaPathError,
} from "./protectedPaths.js";
export function registerAcaiWriteTool(server) {
server.tool(
@@ -28,6 +33,10 @@ Before writing, check the matching documentation for the file type:
return buildProtectedLayoutPathError(file_path);
}
if (isProtectedSchemaPath(file_path)) {
return buildProtectedSchemaPathError(file_path);
}
const { projectSlug, projectDir } = getCurrentProjectInfo();
const result = await callLocalFileEndpoint("POST", "/api/files/write", {
project: projectSlug,