UNPKG

@wonderwhy-er/desktop-commander

Version:

MCP server for terminal operations and file editing

25 lines (24 loc) 878 B
/** * SPDX-License-Identifier: PolyForm-Small-Business-1.0.0 * * Copyright (c) 2025 Desktope Commander MCP Contributors * * This file is licensed under the PolyForm Small Business License 1.0.0 * See the LICENSE file in the /src/polyform directory for the full license text. */ import { performSearchReplace } from './edit.js'; import { EditBlockArgsSchema } from './schemas.js'; /** * Handle edit_block command with enhanced functionality * - Supports multiple replacements * - Validates expected replacements count * - Provides detailed error messages */ export async function handleEnhancedEditBlock(args) { const parsed = EditBlockArgsSchema.parse(args); const searchReplace = { search: parsed.old_string, replace: parsed.new_string }; return performSearchReplace(parsed.file_path, searchReplace, parsed.expected_replacements); }