Skip to main content
Glama
Platano78

Smart-AI-Bridge

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

TableJSON Schema
NameRequiredDescriptionDefault
create_backupNo
file_operationsYes

Implementation Reference

  • 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);
    }
  • 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']
      }
    },
  • 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']
    }
  • 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
      );
  • 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 };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Platano78/Smart-AI-Bridge'

If you have feedback or need assistance with the MCP directory API, please join our Discord server