interactive_edit_session
Start an interactive editing session to perform complex file modifications using step-by-step instructions for precise control over changes.
Instructions
Start an interactive editing session for complex edits
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | List of files to edit | |
| instructions | No | Instructions for the editing session |
Implementation Reference
- src/index.ts:306-329 (registration)Registration of the interactive_edit_session tool, including input schema, description, 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 } });
- src/index.ts:309-321 (schema)Input schema definition for the interactive_edit_session tool.inputSchema: { type: 'object', properties: { files: { type: 'array', description: 'List of files to edit' }, instructions: { type: 'string', description: 'Instructions for the editing session' } }, required: ['files']
- src/router/operation-router.ts:438-445 (handler)Handler logic in executeWithEdit: creates edit session for the files and returns sessionId without closing it.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 };
- Core helper function createEditSession that spawns an EditInstance process, opens the specified files, and returns the session ID for interactive use.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; }
- Ensures the session remains open for interactive_edit_session by skipping closeEditSession.if (operation.type !== 'interactive_edit_session') { await this.editInstanceManager.closeEditSession(sessionId).catch(console.error); }