JetBrains / JetBrains/mcp-server-plugin

Feature Request: Add optimize_imports and run_code_cleanup tools

Open
#50 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
134
Forks
42
PR merge metrics
No merged PRs in 30d

Description

## Problem

When using `replace_text_in_file`, the plugin auto-saves the file immediately after modification. This means IntelliJ's **Actions on Save** (optimize imports, reformat, code cleanup) never triggers — the file is never "dirty" from the IDE's perspective when the save occurs.

This leaves unused imports, unoptimized code, and other cleanup issues in place after MCP-driven edits, which is the opposite of what happens when editing manually in the IDE.

## Requested Tools

- **`optimize_imports`** — run import optimization on a specified file (equivalent to Code → Optimize Imports)
- **`run_code_cleanup`** — run the configured code cleanup inspection profile on a specified file (equivalent to Code → Code Cleanup)

## Alternative

An option on `replace_text_in_file` (e.g. `triggerActionsOnSave: true`) to trigger the configured Actions on Save after the edit, rather than a plain save.

## Context

This is especially relevant for Java projects where IDE-managed imports and code cleanup are a standard part of the workflow. When AI assistants edit files via MCP, the resulting code should match what the developer would see if they made the same edit manually in the IDE.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.