write_files_atomic
Write multiple files atomically with backup support to ensure data integrity during file modifications. Provides enterprise-grade safety mechanisms for reliable file operations.
Instructions
✍️ Write multiple files atomically with backup - Enterprise-grade file modification with safety mechanisms
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| create_backup | No | ||
| file_operations | Yes |
Input Schema (JSON Schema)
{
"properties": {
"create_backup": {
"default": true,
"type": "boolean"
},
"file_operations": {
"items": {
"properties": {
"content": {
"type": "string"
},
"operation": {
"default": "write",
"enum": [
"write",
"append",
"modify"
],
"type": "string"
},
"path": {
"type": "string"
}
},
"required": [
"path",
"content"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"file_operations"
],
"type": "object"
}
Implementation Reference
- smart-ai-bridge-v1.1.0.js:1013-1015 (handler)The primary handler function for the 'write_files_atomic' tool. It delegates the operation to the FileModificationManager's orchestrateOperation method with 'atomic_write' type.async handleWriteFilesAtomic(args) { return await this.fileManager.orchestrateOperation('atomic_write', args); }
- smart-ai-bridge-v1.1.0.js:308-334 (registration)Registration of the 'write_files_atomic' tool in the coreToolDefinitions array within SmartAliasResolver.initializeCoreTools(), including name, description, handler reference, and input schema.name: 'write_files_atomic', description: '✍️ Write multiple files atomically with backup - Enterprise-grade file modification with safety mechanisms', handler: 'handleWriteFilesAtomic', schema: { type: 'object', properties: { file_operations: { type: 'array', items: { type: 'object', properties: { path: { type: 'string' }, content: { type: 'string' }, operation: { type: 'string', enum: ['write', 'append', 'modify'], default: 'write' } }, required: ['path', 'content'] } }, create_backup: { type: 'boolean', default: true } }, required: ['file_operations'] } },
- smart-ai-bridge-v1.1.0.js:311-333 (schema)Input schema definition for the 'write_files_atomic' tool, specifying the structure for file_operations array and create_backup option.schema: { type: 'object', properties: { file_operations: { type: 'array', items: { type: 'object', properties: { path: { type: 'string' }, content: { type: 'string' }, operation: { type: 'string', enum: ['write', 'append', 'modify'], default: 'write' } }, required: ['path', 'content'] } }, create_backup: { type: 'boolean', default: true } }, required: ['file_operations'] }
- smart-ai-bridge-v1.1.0.js:718-722 (helper)Helper logic in FileModificationManager.orchestrateOperation() that handles the 'atomic_write' operation by calling MultiAIRouter.performAtomicFileWrite.case 'atomic_write': result = await this.router.performAtomicFileWrite( params.file_operations, params.create_backup );
- smart-ai-bridge-v1.1.0.js:826-829 (helper)Placeholder implementation of the atomic file write logic in MultiAIRouter.performAtomicFileWrite(), which would contain the actual file writing code in a full implementation.async performAtomicFileWrite(fileOperations, createBackup) { // Placeholder implementation return { success: true, files_written: fileOperations.length }; }