Skip to main content
Glama
davidfstr
by davidfstr

Revise MCP

Tools to revise and refactor code via MCP (Model Context Protocol).

Installation

  • Install Python 3.14+

  • Install pipx: python3 -m pip install pipx

  • Install Revise MCP:

pipx install revise-mcp
which revise
# /Users/YOUR_USERNAME/.local/bin/revise

Related MCP server: uni-kb

Usage

VS Code MCP Configuration

Add to your VS Code MCP settings:

{
    "servers": {
        "revise": {
            "type": "stdio",
            "command": "/Users/YOUR_USERNAME/.local/bin/revise",
            "args": []
        },
    }
}

Claude Code MCP Configuration

Run once to register Revise MCP for all your projects:

claude mcp add --scope user revise -- /Users/YOUR_USERNAME/.local/bin/revise

Tools

move_string_in_file

Moves a contiguous range of lines from one location to another within a file (or between files). Uses substring matching with a ⬥ marker to identify cut boundaries and paste location — no line counting or coordinate math required.

Does not alter indentation of the moved text. Use indent_dedent afterward if the moved text needs re-indentation at its new location.

Parameters:

  • cutFilePath — Absolute path to the file containing the text to move

  • cutStartAt — Substring fragment identifying the line where the cut begins. The ⬥ marks a position on the target line; the cut starts at the beginning of that line

  • cutEndAt — Substring fragment identifying the line after the cut ends. The cut ends before this line (exclusive)

  • pasteAt — Substring fragment marking the insertion point, with ⬥ adjacent to a \n or file boundary. Matched against the pre-cut file state

  • pasteFilePath (optional) — Absolute path to the paste destination file. Defaults to cutFilePath (same-file move)

Example — move a class before another definition:

{
  "cutFilePath": "/path/to/file.py",
  "cutStartAt": "class MyClass:",
  "cutEndAt": "class NextClass:",
  "pasteAt": "\n⬥def top_level_function():"
}

indent_dedent

Indents or unindents a contiguous range of lines by a specified number of levels. Uses substring matching with a ⬥ marker to identify the range boundaries — no line counting required.

Empty lines within the range are left unchanged. Indent size is auto-detected from the file if not specified.

Parameters:

  • filePath — Absolute path to the file to edit

  • indentStartAt — Substring fragment identifying the first line to indent/unindent. The ⬥ marks a position on the target line; the entire line is included

  • indentEndAt — Substring fragment identifying the last line to indent/unindent (inclusive)

  • indentDelta — Number of indent levels to add (positive) or remove (negative)

  • indentSize (optional) — Spaces per indent level (e.g., 4), or "\t" for tabs. Auto-detected if omitted

Example — indent a block, then wrap it:

{
  "filePath": "/path/to/file.py",
  "indentStartAt": "# Create home URL\n⬥",
  "indentEndAt": "(home_ti,) = root_ti.Children⬥\n",
  "indentDelta": 1
}

Then use replace_string_in_file to insert if condition: before the indented block.

outline_file

Returns a high-level outline of a file, similar to VS Code's folded view. Useful for quickly understanding the structure of a large file before reading it in full.

Includes only structurally significant lines, currently optimized for the Python language only:

  • class, def, and async def definitions (at any indentation level)

  • if __name__ == '__main__': guards

  • Section separator comments (# === ... or # --- ...), plus the immediately following section-name comment if present

Output is one line per entry in the form LINE_NUMBER:LINE_CONTENT (1-indexed).

Parameters:

  • filePath — Absolute path to the file to outline

Example:

{
  "filePath": "/path/to/file.py"
}

rename_symbol (optional)

Renames a symbol (function, variable, class, etc.) and all its references across the workspace using VS Code's LSP-backed rename. Uses text-based matching to locate the symbol — no coordinate counting required.

Note: This tool is optional and has additional setup requirements. See Optional: rename_symbol Setup below.

It is most useful for AI coding harnesses that do not provide their own symbolic rename tool (e.g. Claude Code). VS Code users already have a native rename tool and may skip this.

Parameters:

  • filePath — Absolute path to the file containing the symbol to rename

  • oldString — Line fragment containing the original symbol name. Must be unique within the file (or within the specified line). Example: 'def mocked_show_modal('

  • newString — Line fragment with all occurrences of the symbol renamed. Example: 'def mocked_show_modal_renamed('

  • line (optional) — 1-indexed line number to limit the search for oldString. Use when oldString appears on multiple lines

Example:

{
  "filePath": "/path/to/file.py",
  "oldString": "def helper_function(",
  "newString": "def _helper_function("
}

This renames helper_function to _helper_function everywhere it is referenced.

Optional: rename_symbol Setup

The rename_symbol tool delegates the actual rename operation to VS Code via the VSC as MCP extension. This means:

  1. VS Code must be running with the project open.

  2. The "VSC as MCP" extension must be installed in VS Code. It exposes a local MCP server (by default at http://localhost:4000/mcp) that Revise MCP calls internally.

Steps

  1. Install the VSC as MCP extension in VS Code.

  2. Open VS Code with the project you want to rename symbols in.

  3. Ensure Revise MCP is configured in your AI coding harness (see Installation and Usage).

No additional configuration of Revise MCP itself is required — rename_symbol will automatically connect to the VSC as MCP server on localhost:4000.

Contributing

See doc/DESIGN.md for a high-level introduction to the server design and the principles guiding tool development.

To publish a new release to PyPI, see doc/RELEASING.md.

Local Development Setup

Requires Python 3.14+ and Poetry.

# Checkout code
git checkout https://github.com/davidfstr/revise-mcp.git
cd revise-mcp

# Create/update the virtual environment at .venv/
poetry install

# Run the server locally
poetry run python -m revise

# Run tests
poetry run pytest tests/

Testing with MCP Inspector

# Start in HTTP mode for testing with MCP Inspector
poetry run python -m revise --transport streamable-http

# In another terminal, start the inspector
npx -y @modelcontextprotocol/inspector

VS Code MCP Configuration (Development)

To run the MCP server from your development checkout rather than an installed binary, point VS Code at the Poetry-managed venv:

{
    "servers": {
        "revise": {
            "type": "stdio",
            "cwd": "/path/to/revise-mcp",
            "command": "poetry",
            "args": ["run", "python", "-m", "revise"]
        },
    }
}

Available Tools

4 tools
indent_dedentA

Indents or unindents a range of lines in a file.

Specify the range using substring matching with a ⬥ marker. The ⬥ identifies which line is the boundary — the full line containing the ⬥ is included in the range.

Common pattern — indent a block, then wrap it: 1. indent_dedent(indentStartAt="# Create home URL\n⬥", ..., indentDelta=1) 2. replace_string_in_file to insert "if True:" before the indented block

⬥ in boundaries anywhere on a line marks the line to indent when the context contains multiple lines. No ⬥ is needed if the context is within a single line only.

Whitespace at the end of lines is ignored when matching substrings.

Empty lines within the range are left unchanged (no whitespace added). Non-empty lines (including whitespace-only lines) are indented/unindented.

ParametersJSON Schema
NameRequiredDescriptionDefault
filePathYes
indentStartAtYes
indentEndAtYes
indentDeltaYes
indentSizeNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses key behaviors: substring matching with ⬥ marker, ignoring trailing whitespace, leaving empty lines unchanged, and indenting/unindenting non-empty lines. While it does not cover error cases or persistence details, it provides substantial behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is structured with bullet points and an example, front-loading the purpose. It is appropriately sized for the complexity of the tool, though it could be slightly more concise by removing the common pattern commentary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that an output schema exists, description does not need to cover return values. It explains the main parameters and behavior adequately. However, it lacks error handling or edge cases (e.g., substring not found), slightly reducing completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must add meaning. It explains the role of indentStartAt and indentEndAt as substring markers, and the indentDelta parameter via example (indentDelta=1). It does not fully explain indentSize or the sign of indentDelta, but it compensates for the lack of schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool 'Indents or unindents a range of lines in a file', specifying the verb (indent/unindent) and resource (lines in a file). This clearly distinguishes it from sibling tools like move_string_in_file or outline_file, which have different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains how to specify the range using substring matching with the ⬥ marker, and provides a common pattern example with a follow-up step. It gives clear context for usage, though it lacks explicit exclusions or when-not-to-use scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

move_string_in_fileA

Moves a continuous range of lines from one location to another within a file (or between files).

Specify cut boundaries and paste location using substring matching with an optional ⬥ marker.

Example 1: Move a definition before another definition: cutStartAt: "class MyClass:" (start at this line) cutEndAt: "class NextClass:" (end BEFORE this line) pasteAt: "\n⬥def target_function():" (paste adjacent to the \n)

Example 2: Move a paragraph after another paragraph: cutStartAt: "# Close the database" (start at this line) cutEndAt: "db.close()\n⬥" (end after the final paragraph line) pasteAt: "db.open()\n⬥" (paste after a different paragraph's last line)

⬥ in cut boundaries anywhere in a line marks the line to cut when the cut context contains multiple lines. No ⬥ is needed if cut context is within a single line only.

⬥ in a paste boundary must be adjacent to a \n or the start/end of the file. All lines will be pasted before/after the nearby \n or file boundary.

Whitespace at the end of lines is ignored when matching substrings.

After editing reports on blank lines around the cut and paste boundaries, simplifying clean up of nearby line spacing with small subsequent edits.

Does not alter indentation. Use indent_dedent to adjust indentation after moving if needed.

ParametersJSON Schema
NameRequiredDescriptionDefault
cutFilePathYes
cutStartAtYes
cutEndAtYes
pasteAtYes
pasteFilePathNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It explains that whitespace is ignored when matching, that indentation is not altered, and that the tool reports on blank lines after editing. It also describes the marker system for specifying cut/paste boundaries. However, it does not explicitly state that the operation modifies the file destructively (cutting lines), which could be implied but not clearly stated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is verbose and includes two long examples, which are helpful but detract from conciseness. The marker explanation is repeated twice. The front-loading is acceptable, but the description could be shorter while retaining clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, 0% schema coverage, no annotations, but has output schema), the description is fairly complete. It covers the marker system, paste positioning relative to newlines, and edge cases (single line vs. multi-line cut). It mentions the post-editing blank line report. However, details about the return value or error handling are absent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must add meaning beyond the schema. It explains cutStartAt, cutEndAt, and pasteAt via examples, including the use of the ⬥ marker for multi-line contexts. It also mentions the optional pasteFilePath for moving between files. The description provides significant context that the schema alone does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool moves a continuous range of lines from one location to another within a file or between files. It distinguishes itself from sibling tools like indent_dedent (indentation) and rename_symbol (renaming) by specifying its unique operation—cutting and pasting lines based on substring matching.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides two detailed examples illustrating typical use cases (moving a definition before another, moving a paragraph). It also advises to use indent_dedent for indentation adjustments after moving, giving clear guidance on when to use this tool versus alternatives. However, it does not explicitly state when not to use the tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

outline_fileA

Returns a high-level outline of a file, similar to VS Code's folded view.

Shows only structurally significant lines:

  • class and def definitions (at any indentation level)

  • Section separator comments (# === ... or # --- ... prefix, at any indentation)

  • Section name comments that immediately follow a pure separator line

Output format: "LINE_NUMBER:LINE_CONTENT" (1-indexed), one per line. Useful for understanding the structure of a large file before reading it in full.

ParametersJSON Schema
NameRequiredDescriptionDefault
filePathYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description carries full burden. It discloses the output format (LINE_NUMBER:LINE_CONTENT, 1-indexed) and the specific selection criteria for lines. It does not mention destructive actions or auth needs, but as a read-only tool, that's acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured. First sentence states purpose, then lists what is shown, then output format, then use case. No extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with one parameter and no annotations, the description covers the output comprehensively. It explains selection criteria and format. It does not mention limitations or error handling, but it's still fairly complete for its complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not mention the 'filePath' parameter. While the parameter name is self-explanatory, the description adds no additional meaning or constraints (e.g., expected format, restrictions) beyond the schema's type declaration.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns a high-level outline of a file, similar to VS Code's folded view. It specifies what structural lines are included (class/def, separator comments). The purpose is distinct from sibling tools (indent_dedent, move_string_in_file, rename_symbol).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description says it's 'useful for understanding the structure of a large file before reading it in full,' which implies when to use. It doesn't explicitly say when not to use, but the purpose is clear enough that an AI agent can infer appropriate usage contexts.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

rename_symbolA

Renames a symbol (function, variable, class, etc.) and all its references across the workspace.

Uses text-based matching to locate the symbol—no coordinate counting required.

Example: filePath: "/path/to/file.py" oldString: "def helper_function(" newString: "def _helper_function("

This will rename helper_function to _helper_function everywhere it's referenced.
ParametersJSON Schema
NameRequiredDescriptionDefault
filePathYes
oldStringYes
newStringYes
lineNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility. It states that it renames the symbol 'and all its references', which is transparent about scope. However, it does not disclose potential side effects like handling name collisions, updating imports, or requiring confirmation. This is adequate but not fully comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, with the main action in the first sentence. The example is helpful and well-structured. No superfluous text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is an output schema (though not shown), so the description need not explain return values. The description covers the core behavior well. However, given no annotations, it could add more context about prerequisites or limitations, but overall it is fairly complete for a rename tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. The example explains the use of filePath, oldString, and newString, but the optional 'line' parameter is not described. The description adds meaning for three of four parameters via example, but missing explanation for 'line' leaves a gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'renames' and the resource 'symbol (function, variable, class, etc.) and all its references across the workspace'. It distinguishes from sibling tools which are about indentation, moving strings, and outlining, none of which are rename operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains that it uses text-based matching rather than coordinate counting, which helps the agent understand when to use this tool (for text-based symbols) versus alternatives. It does not explicitly state when not to use it, but the example provides clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.1
    • First observedindent_dedent
    • First observedmove_string_in_file
    • First observedoutline_file
    • First observedrename_symbol

TDQS

A4.2/5.0

Scored across 4 tools

Disambiguation5/5

Each tool addresses a distinct editing operation: indentation, moving lines, outlining, and renaming. No overlap or confusion among them.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with underscores (e.g., indent_dedent, move_string_in_file), making them predictable and readable.

Tool Count5/5

With 4 tools, the server is well-scoped for a focused code editing purpose, not too few or too many.

Completeness2/5

The server lacks basic text editing tools like replace, insert, or delete, which are essential for comprehensive file editing. The mention of 'replace_string_in_file' in descriptions suggests a gap.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    AST-targeted code editing MCP server with 28 surgical tools for structural edits across 11 languages. Built on tree-sitter, replaces brittle search/replace with byte-correct edits keyed by symbol names.
    28
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables parsing, indexing, and querying source code as structured knowledge, providing code exploration, spec generation, and migration tools via 20 MCP tools.
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP wrapper for Metals (Scala language server) that adds file editing and refactoring tools such as rename-symbol, add-import, and remove-unused-imports.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides code intelligence by indexing source code into SQLite and offering MCP tools for symbol search, flow tracing, and context retrieval to assist with code navigation and understanding.
    -