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 Grep tool after searching for content within files.

Remarks

The Grep tool is built on ripgrep and provides powerful content search capabilities with full regex support. This response is received in the GrepPostToolUsePayload when the tool_name is “Grep”. The response structure varies based on the GrepToolInput.OutputMode:
  • "files_with_matches" (default) - Returns only file paths containing matches
  • "content" - Returns matching lines with context
  • "count" - Returns match counts per file
Example JSON payload (files_with_matches mode):

Constructors

.ctor

Syntax

.ctor Inherited

Inherited from object

Syntax

Properties

AppliedLimit

Gets or sets the head_limit that was applied to the results.

Syntax

Property Value

Type: System.Nullable<int>?

AppliedOffset

Gets or sets the offset that was applied to the results.

Syntax

Property Value

Type: System.Nullable<int>?

Content

Gets or sets the matching content with line numbers and optional context.

Syntax

Property Value

Type: string?

Examples

Remarks

This property is populated when GrepToolResponse.Mode is "content". It contains the actual matching lines from the files, formatted with line numbers. The format includes the file path, line number, and matching content. Additional context lines can be included using the -A, -B, or -C parameters in GrepToolInput.

Counts

Gets or sets the match counts per file.

Syntax

Property Value

Type: System.Collections.Generic.Dictionary<string, int>?

Examples

Remarks

This property is populated when GrepToolResponse.Mode is "count". The dictionary keys are absolute file paths, and the values are the number of matches found in each file. This is useful for understanding the distribution of matches across files before deciding which files to read or edit.

Filenames

Gets or sets the list of file paths containing matches.

Syntax

Property Value

Type: System.Collections.Generic.List<string>?

Remarks

This property is populated when GrepToolResponse.Mode is "files_with_matches". It contains the absolute paths to all files where the search pattern was found. Files are listed in the order they were found. Use the GrepToolInput.HeadLimit parameter to limit the number of results.

Mode

Gets or sets the output mode that was used for the search.

Syntax

Property Value

Type: CloudNimble.ClaudeEssentials.Hooks.GrepOutputMode?

Remarks

This indicates which output format was requested and determines which properties contain the results:

NumFiles

Gets or sets the number of files that contained matches.

Syntax

Property Value

Type: int

Remarks

This represents the count of unique files where the pattern was found. When GrepToolResponse.Mode is "files_with_matches", this equals the length of GrepToolResponse.Filenames.

NumLines

Gets or sets the number of lines in the content output.

Syntax

Property Value

Type: System.Nullable<int>?

Remarks

This property is populated when GrepToolResponse.Mode is "content".

NumMatches

Gets or sets the total number of pattern matches found.

Syntax

Property Value

Type: System.Nullable<int>?

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?