Skip to main content

Definition

Assembly: CloudNimble.ClaudeEssentials.dll Namespace: CloudNimble.ClaudeEssentials.Hooks.Tools.Responses Inheritance: System.Object

Syntax

Summary

Represents the response payload returned by the Claude Code Edit tool after performing a string replacement in a file.

Remarks

The Edit tool performs exact string replacements in files. It requires that the target file has been read at least once in the conversation before editing. This response is received in the EditPostToolUsePayload when the tool_name is “Edit”. The Edit tool will fail if the EditToolInput.OldString is not unique in the file, unless EditToolInput.ReplaceAll is set to true. Example JSON payload:

Constructors

.ctor

Syntax

.ctor Inherited

Inherited from object

Syntax

Properties

FilePath

Gets or sets the absolute path to the file that was edited.

Syntax

Property Value

Type: string

Examples

Remarks

This is always an absolute path, regardless of whether the original request used a relative or absolute path. On Windows, this will use backslash separators.

NewString

Gets or sets the new string that replaced the old string.

Syntax

Property Value

Type: string

Remarks

This is the replacement text that now appears in the file where EditToolResponse.OldString was previously located.

OldString

Gets or sets the original string that was searched for and replaced.

Syntax

Property Value

Type: string

Remarks

This is the exact string that was matched in the file. The Edit tool preserves the exact indentation (tabs/spaces) from the original file content.

OriginalFile

Gets or sets the complete original content of the file before the edit was applied.

Syntax

Property Value

Type: string

Remarks

This contains the full file content prior to the replacement, which can be useful for implementing undo functionality, auditing changes, or verifying the context of the edit.

ReplaceAll

Gets or sets a value indicating whether all occurrences of the old string were replaced, or just the first occurrence.

Syntax

Property Value

Type: bool

Remarks

When false (the default), the Edit tool requires that EditToolResponse.OldString appears exactly once in the file, and only that single occurrence is replaced. When true, all occurrences of EditToolResponse.OldString in the file are replaced with EditToolResponse.NewString. This is useful for renaming variables or updating repeated patterns throughout a file.

StructuredPatch

Gets or sets the structured patch representing the changes made to the file.

Syntax

Property Value

Type: System.Collections.Generic.List<CloudNimble.ClaudeEssentials.Hooks.Tools.Responses.StructuredPatchHunk>

Remarks

This contains a unified diff representation showing what changed between the original and edited content. Each StructuredPatchHunk represents a contiguous block of changes. When EditToolResponse.ReplaceAll is true and multiple replacements were made, there may be multiple hunks in the patch, one for each replacement location.

UserModified

Gets or sets a value indicating whether the file was modified by the user since it was last read by Claude.

Syntax

Property Value

Type: bool

Remarks

If true, Claude detected that the file content changed between when it was read and when the edit was applied. This can happen if the user edits the file externally while Claude is working. This flag helps track potential merge conflicts or unexpected changes in the editing workflow.

Methods

Equals Inherited Virtual

Inherited from object

Syntax

Parameters

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

Parameters

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

Returns

Type: string?