tools

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatFileContent

func FormatFileContent(filePath string, content string) string

FormatFileContent formats a file's content with line numbers, similar to the built-in Read tool. Output format: header line with path and line count, followed by numbered lines.

func FormatFileResults

func FormatFileResults(results []index.FileSearchResult, nameOnly bool) string

FormatFileResults formats file search results as human-readable text.

func FormatSearchResults

func FormatSearchResults(results []index.ContentSearchResult, totalMatches int) string

FormatSearchResults formats content search results as human-readable text. Groups matches by file with line numbers and optional context.

Types

type FilesArgs

type FilesArgs struct {
	Pattern    string `json:"pattern" jsonschema:"Glob pattern to match files (e.g. **/*.ts or src/**/*.go)"`
	NameOnly   bool   `json:"nameOnly,omitempty" jsonschema:"If true return only file paths without metadata"`
	MaxResults int    `json:"maxResults,omitempty" jsonschema:"Maximum number of results to return (default 50)"`
}

FilesArgs defines the input parameters for the codeindex_files tool.

type FilesHandler

type FilesHandler struct {
	FileIndex *index.FileIndex
	Logger    *slog.Logger
}

FilesHandler holds the dependencies for the files tool.

func (*FilesHandler) Handle

Handle processes a codeindex_files request.

type ReadArgs

type ReadArgs struct {
	FilePath string `json:"filePath" jsonschema:"Relative file path to read from the index (e.g. src/main.go)"`
}

ReadArgs defines the input parameters for the codeindex_read tool.

type ReadHandler

type ReadHandler struct {
	ContentIndex *index.ContentIndex
	Logger       *slog.Logger
}

ReadHandler holds the dependencies for the read tool.

func (*ReadHandler) Handle

Handle processes a codeindex_read request.

type ReindexArgs

type ReindexArgs struct{}

ReindexArgs defines the input parameters for the codeindex_reindex tool.

type ReindexFunc

type ReindexFunc func() (indexedCount int, totalSize int64, elapsed string, err error)

ReindexFunc is the function signature for the reindex operation. It is provided by main.go to avoid circular dependencies.

type ReindexHandler

type ReindexHandler struct {
	DoReindex ReindexFunc
	Logger    *slog.Logger
}

ReindexHandler holds the dependencies for the reindex tool.

func (*ReindexHandler) Handle

Handle processes a codeindex_reindex request.

type SearchArgs

type SearchArgs struct {
	Query        string `json:"query" jsonschema:"Search query. Plain text for word match, quoted for exact phrase, /regex/ for regular expression"`
	FilePath     string `` /* 147-byte string literal not displayed */
	FileGlob     string `json:"fileGlob,omitempty" jsonschema:"Optional glob pattern to filter files (e.g. **/*.go)"`
	MaxResults   int    `json:"maxResults,omitempty" jsonschema:"Maximum number of file results to return (default 50)"`
	ContextLines int    `json:"contextLines,omitempty" jsonschema:"Number of context lines before and after each match (default 2)"`
}

SearchArgs defines the input parameters for the codeindex_search tool.

type SearchHandler

type SearchHandler struct {
	ContentIndex *index.ContentIndex
	Logger       *slog.Logger
}

SearchHandler holds the dependencies for the search tool.

func (*SearchHandler) Handle

Handle processes a codeindex_search request.

type StatusArgs

type StatusArgs struct{}

StatusArgs defines the input parameters for the codeindex_status tool (none required).

type StatusHandler

type StatusHandler struct {
	FileIndex    *index.FileIndex
	ContentIndex *index.ContentIndex
	StartTime    time.Time
	RootDir      string
	Logger       *slog.Logger
}

StatusHandler holds the dependencies for the status tool.

func (*StatusHandler) Handle

Handle processes a codeindex_status request.

Jump to

Keyboard shortcuts

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