edit

package
v0.20.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package edit implements the file editing tool with atomic multi-file transactions, formatting, compiler gates, and spelling aids.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(server *mcp.Server)

Register registers the smart_edit tool with the server.

Types

type FileEdit added in v0.16.0

type FileEdit struct {
	//nolint:lll
	Filename   string `json:"filename" jsonschema:"The absolute path to the file to edit. You MUST use absolute paths in multi-root workspaces."`
	OldContent string `json:"old_content,omitempty" jsonschema:"Optional: The block of code to find (ignores whitespace)"`
	NewContent string `json:"new_content" jsonschema:"The new code to insert"`
	StartLine  int    `json:"start_line,omitempty" jsonschema:"Optional: restrict search to this line number and after"`
	EndLine    int    `json:"end_line,omitempty" jsonschema:"Optional: restrict search to this line number and before"`
	//nolint:lll
	Threshold float64 `json:"threshold,omitempty" jsonschema:"Similarity threshold (0.0-1.0) for fuzzy matching, default 0.95"`
	//nolint:lll
	Append bool `json:"append,omitempty" jsonschema:"If true, append new_content to the end of the file (ignores old_content)"`
}

FileEdit defines a single edit transaction within the smart_edit tool.

type Params

type Params struct {
	Edits      []FileEdit `json:"edits,omitempty" jsonschema:"List of edits to perform atomically"`
	Filename   string     `json:"filename,omitempty" jsonschema:"Deprecated: use absolute path in edits instead"`
	OldContent string     `json:"old_content,omitempty" jsonschema:"Deprecated: use edits instead"`
	NewContent string     `json:"new_content,omitempty" jsonschema:"Deprecated: use edits instead"`
	StartLine  int        `json:"start_line,omitempty" jsonschema:"Deprecated: use edits instead"`
	EndLine    int        `json:"end_line,omitempty" jsonschema:"Deprecated: use edits instead"`
	Threshold  float64    `json:"threshold,omitempty" jsonschema:"Deprecated: use edits instead"`
	Append     bool       `json:"append,omitempty" jsonschema:"Deprecated: use edits instead"`
}

Params defines the input parameters for the smart_edit tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL