Skip to main content
Glama

interactive_edit_session

Initiate an interactive editing session to modify complex files directly, guided by custom instructions for precise and structured changes.

Instructions

Start an interactive editing session for complex edits

Input Schema

NameRequiredDescriptionDefault
filesYesList of files to edit
instructionsNoInstructions for the editing session

Input Schema (JSON Schema)

{ "properties": { "files": { "description": "List of files to edit", "type": "array" }, "instructions": { "description": "Instructions for the editing session", "type": "string" } }, "required": [ "files" ], "type": "object" }

Implementation Reference

  • src/index.ts:306-329 (registration)
    Registers the interactive_edit_session tool including its name, description, input schema, and annotations.
    mcpServer.registerTool({ name: 'interactive_edit_session', description: 'Start an interactive editing session for complex edits', inputSchema: { type: 'object', properties: { files: { type: 'array', description: 'List of files to edit' }, instructions: { type: 'string', description: 'Instructions for the editing session' } }, required: ['files'] }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false } });
  • Defines the input schema for the interactive_edit_session tool, requiring a list of files and optionally instructions.
    inputSchema: { type: 'object', properties: { files: { type: 'array', description: 'List of files to edit' }, instructions: { type: 'string', description: 'Instructions for the editing session' } }, required: ['files']
  • Dispatches the interactive_edit_session operation by creating an edit session via EditInstanceManager and returning the session ID.
    case 'interactive_edit_session': // Return the session ID for the client to use return { sessionId };
  • Implements the core logic for starting an interactive edit session: generates session ID, creates EditInstance, opens specified files, and returns session ID.
    public async createEditSession(files: string[]): Promise<string> { const sessionId = uuidv4(); const instance = await this.createInstance(sessionId); // Open all files for (const file of files) { await instance.openFile(file); } return sessionId; }
  • The executeWithEdit method in OperationRouter that orchestrates EditInstanceManager calls for edit operations, specially handling interactive_edit_session by not closing the session.
    private async executeWithEdit(operation: MCPOperation): Promise<any> { // Create a session for the operation const sessionId = await this.editInstanceManager.createEditSession(operation.affectedFiles); try { switch (operation.type) { case 'interactive_edit_session': // Return the session ID for the client to use return { sessionId }; case 'format_code': return this.editInstanceManager.executeEditCommand(sessionId, { type: 'edit', params: { action: 'format', language: operation.params.language } }); case 'complex_find_replace': return this.editInstanceManager.executeEditCommand(sessionId, { type: 'replace', params: { pattern: operation.params.pattern, replacement: operation.params.replacement, options: operation.params.options } }); case 'merge_conflicts_resolution': return this.editInstanceManager.performComplexEdit(sessionId, { type: 'merge_conflicts', params: { strategy: operation.params.strategy } }); case 'bulk_edit_operation': return this.editInstanceManager.coordinateMultiFileEdit({ files: operation.affectedFiles, operation: operation.params.operation as EditCommand }); case 'edit_with_context_awareness': return this.editInstanceManager.performComplexEdit(sessionId, { type: 'context_aware_edit', params: { surroundingFiles: operation.params.surroundingFiles } }); default: throw new Error(`Unsupported operation type for Edit: ${operation.type}`); } } finally { // Close the session unless it's an interactive session if (operation.type !== 'interactive_edit_session') { await this.editInstanceManager.closeEditSession(sessionId).catch(console.error); } } }

Other Tools

Related Tools

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/mixelpixx/edit-mcp'

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