Documentation
¶
Overview ¶
Package smartedit implements the file editing tool with atomic multi-file transactions, formatting, compiler gates, and spelling aids.
Index ¶
- func ExecuteEdits(ctx context.Context, session *mcp.ServerSession, edits []FileEdit) (*mcp.CallToolResult, error)
- func Handler(ctx context.Context, req *mcp.CallToolRequest, args SingleEditParams) (*mcp.CallToolResult, any, error)
- func Register(server *mcp.Server)
- type FileEdit
- type SingleEditParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteEdits ¶
func ExecuteEdits(ctx context.Context, session *mcp.ServerSession, edits []FileEdit) (*mcp.CallToolResult, error)
ExecuteEdits performs a set of file edits atomically in a compiler-verified transaction.
func Handler ¶ added in v0.33.0
func Handler( ctx context.Context, req *mcp.CallToolRequest, args SingleEditParams, ) (*mcp.CallToolResult, any, error)
Handler handles the smart_edit tool execution.
Types ¶
type FileEdit ¶
type FileEdit struct {
//nolint:lll
Filename string `json:"filename" jsonschema:"The absolute path to the file to edit. Required. Relative paths are rejected."`
//nolint:lll
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"`
//nolint:lll
StartLine int `json:"start_line,omitempty" jsonschema:"Optional: restrict search window to line number >= start_line"`
//nolint:lll
EndLine int `json:"end_line,omitempty" jsonschema:"Optional: restrict search window to line number <= end_line"`
//nolint:lll
Threshold float64 `json:"threshold,omitempty" jsonschema:"Optional: similarity threshold (0.0-1.0) for fuzzy matching (default 0.95)"`
//nolint:lll
Append bool `json:"append,omitempty" jsonschema:"Optional: append new_content to end of file"`
}
FileEdit represents a single edit operation inside an atomic transaction.
type SingleEditParams ¶
type SingleEditParams struct {
//nolint:lll
Filename string `json:"filename" jsonschema:"The absolute path to the file to edit. Required. Relative paths are rejected."`
//nolint:lll
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"`
//nolint:lll
StartLine int `json:"start_line,omitempty" jsonschema:"Optional: restrict search window to line number >= start_line"`
//nolint:lll
EndLine int `json:"end_line,omitempty" jsonschema:"Optional: restrict search window to line number <= end_line"`
//nolint:lll
Threshold float64 `json:"threshold,omitempty" jsonschema:"Optional: similarity threshold (0.0-1.0) for fuzzy matching (default 0.95)"`
//nolint:lll
Append bool `json:"append,omitempty" jsonschema:"Optional: append new_content to end of file"`
}
SingleEditParams defines the input parameters for the smart_edit single file edit tool.
Click to show internal directories.
Click to hide internal directories.