mirror of
https://github.com/lukaszraczylo/filepuff-mcp.git
synced 2026-10-18 05:48:00 +00:00
fixup! Update, bugfixes on diff and edit handling
This commit is contained in:
@@ -33,6 +33,16 @@ func (s *Server) handleEdit(ctx context.Context, request mcp.CallToolRequest, ap
|
||||
return mcp.NewToolResultError("operation is required"), nil
|
||||
}
|
||||
|
||||
// Validate operation against known values
|
||||
switch edit.EditOperation(operation) {
|
||||
case edit.EditReplace, edit.EditInsertBefore, edit.EditInsertAfter, edit.EditDelete:
|
||||
// valid
|
||||
default:
|
||||
return mcp.NewToolResultError(fmt.Sprintf(
|
||||
"invalid operation %q: must be one of: replace, insert_before, insert_after, delete", operation,
|
||||
)), nil
|
||||
}
|
||||
|
||||
// Validate path
|
||||
if !s.cfg.IsPathAllowed(file) {
|
||||
return mcp.NewToolResultError("file is outside workspace root"), nil
|
||||
|
||||
Reference in New Issue
Block a user