greptool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package greptool implements the Grep tool — searches file contents using ripgrep. Mirrors src/tools/GrepTool/GrepTool.ts.

M2 scope: files_with_matches mode (default), content mode, count mode; -i case-insensitive; -n line numbers; -B/-A/-C context lines; glob filter; type filter; head_limit/offset pagination; VCS dir exclusion (.git/.svn/.hg). Permissions integration lands in M5.

ripgrep (rg) must be on PATH.

Index

Constants

View Source
const DefaultHeadLimit = 250

DefaultHeadLimit matches the real tool: 250 lines when unspecified.

View Source
const MaxColumns = 500

MaxColumns prevents base64/minified content from cluttering output.

Variables

View Source
var VCSDirectories = []string{".git", ".svn", ".hg", ".bzr", ".jj", ".sl"}

VCSDirectories are excluded from every search to avoid noise.

Functions

This section is empty.

Types

type Tool

type Tool struct{}

Tool implements the Grep tool.

func New

func New() *Tool

New returns a fresh Grep tool.

func (*Tool) Description

func (*Tool) Description() string

Description is the prompt text the model sees.

func (*Tool) Execute

func (t *Tool) Execute(ctx context.Context, raw json.RawMessage) (tool.Result, error)

Execute searches files matching the input and returns results.

func (*Tool) InputSchema

func (*Tool) InputSchema() json.RawMessage

InputSchema is the JSON Schema sent to the model.

func (*Tool) IsConcurrencySafe

func (*Tool) IsConcurrencySafe(json.RawMessage) bool

IsConcurrencySafe: grep is safe to run concurrently.

func (*Tool) IsReadOnly

func (*Tool) IsReadOnly(json.RawMessage) bool

IsReadOnly: grep only reads the filesystem.

func (*Tool) Name

func (*Tool) Name() string

Name implements tool.Tool.

Jump to

Keyboard shortcuts

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