Skip to main content

Definition

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

Syntax

CloudNimble.ClaudeEssentials.Hooks.Tools.Responses.WriteToolResponse

Summary

Represents the response payload returned by the Claude Code Write tool after creating or overwriting a file.

Remarks

The Write tool creates new files or overwrites existing files on the local filesystem. This response is received in the WritePostToolUsePayload when the tool_name is “Write”. Unlike the Edit tool which performs targeted string replacements, the Write tool completely replaces the file content. Claude Code requires that an existing file be read first before it can be overwritten, to prevent accidental data loss. Example JSON payload for a new file:
{
"type": "create",
"filePath": "C:\\Projects\\MyApp\\NewFile.cs",
"content": "using System;\n\nnamespace MyApp { }",
"structuredPatch": [],
"originalFile": null
}

Constructors

.ctor

Syntax

public WriteToolResponse()

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

Content

Gets or sets the content that was written to the file.

Syntax

public string Content { get; set; }

Property Value

Type: string

Remarks

This contains the complete content of the file after the write operation. For new files, this is the entire file content. For overwrites, this is the new content that replaced the original.

FilePath

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

Syntax

public string FilePath { get; set; }

Property Value

Type: string

Examples

"C:\\Users\\Developer\\Projects\\MyApp\\src\\NewClass.cs"

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.

OriginalFile

Gets or sets the original file content before the write operation.

Syntax

public string OriginalFile { get; set; }

Property Value

Type: string?

Remarks

This is null when creating a new file (WriteToolResponse.Type = “create”) since there was no previous content. For overwrites, this contains the complete original content of the file before it was replaced, which can be useful for implementing undo functionality or auditing changes.

StructuredPatch

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

Syntax

public System.Collections.Generic.List<CloudNimble.ClaudeEssentials.Hooks.Tools.Responses.StructuredPatchHunk> StructuredPatch { get; set; }

Property Value

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

Remarks

For new files (WriteToolResponse.Type = “create”), this will be an empty list since there is no previous content to diff against. For overwrites, this contains a unified diff representation showing what changed between the original and new content. Each StructuredPatchHunk represents a contiguous block of changes.

Type

Gets or sets the type of write operation that was performed.

Syntax

public string Type { get; set; }

Property Value

Type: string

Remarks

Known values include:

Methods

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?