Skip to main content
Glama
Platano78

Smart-AI-Bridge

edit_file

Modify files with AI-powered edits using find-and-replace operations, validation modes, and fuzzy matching to ensure accurate content changes.

Instructions

🔧 ENHANCED Intelligent file editing - FileModificationManager orchestrated operations with smart AI routing. AI-powered targeted modifications with validation, rollback capability, and complexity-based endpoint selection for optimal performance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
editsYes
file_pathYes
fuzzy_thresholdNoSimilarity threshold for fuzzy matching (0.1-1.0, higher = more strict)
languageNo
max_suggestionsNoMaximum number of fuzzy match suggestions to provide
suggest_alternativesNoInclude fuzzy match suggestions in error messages
validation_modeNostrict

Implementation Reference

  • The primary handler function for the 'edit_file' MCP tool. It delegates the edit operation to the FileModificationManager.orchestrateOperation with 'single_edit' type.
    async handleEditFile(args) {
      return await this.fileManager.orchestrateOperation('single_edit', args);
    }
  • Input schema for the 'edit_file' tool defining the expected parameters: file_path, array of edits (find/replace pairs), optional language and validation_mode.
    schema: {
      type: 'object',
      properties: {
        file_path: { type: 'string' },
        edits: {
          type: 'array',
          items: {
            type: 'object',
            properties: {
              find: { type: 'string' },
              replace: { type: 'string' },
              description: { type: 'string' }
            },
            required: ['find', 'replace']
          }
        },
        language: { type: 'string' },
        validation_mode: {
          type: 'string',
          enum: ['strict', 'lenient', 'none'],
          default: 'strict'
        }
      },
      required: ['file_path', 'edits']
    }
  • Core tool registration for 'edit_file' in SmartAliasResolver.initializeCoreTools(), including name, description, handler reference, and schema. This object is added to coreTools Map.
    {
      name: 'edit_file',
      description: '🔧 ENHANCED Intelligent file editing - FileModificationManager orchestrated operations with smart AI routing. AI-powered targeted modifications with validation, rollback capability, and complexity-based endpoint selection for optimal performance.',
      handler: 'handleEditFile',
      schema: {
        type: 'object',
        properties: {
          file_path: { type: 'string' },
          edits: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                find: { type: 'string' },
                replace: { type: 'string' },
                description: { type: 'string' }
              },
              required: ['find', 'replace']
            }
          },
          language: { type: 'string' },
          validation_mode: {
            type: 'string',
            enum: ['strict', 'lenient', 'none'],
            default: 'strict'
          }
        },
        required: ['file_path', 'edits']
      }
    },
  • Alias registrations mapping 'MKG_edit' and 'deepseek_edit' to the core 'edit_file' tool in SmartAliasResolver.initializeAliasGroups().
    const aliasDefinitions = [
      // MKG aliases
      { alias: 'MKG_analyze', coreTool: 'review' },
      { alias: 'MKG_generate', coreTool: 'ask' },
      { alias: 'MKG_review', coreTool: 'review' },
      { alias: 'MKG_edit', coreTool: 'edit_file' },
      { alias: 'MKG_health', coreTool: 'health' },
    
      // DeepSeek aliases
      { alias: 'deepseek_analyze', coreTool: 'review' },
      { alias: 'deepseek_generate', coreTool: 'ask' },
      { alias: 'deepseek_review', coreTool: 'review' },
      { alias: 'deepseek_edit', coreTool: 'edit_file' },
      { alias: 'deepseek_health', coreTool: 'health' }
    ];

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