Documentation
¶
Index ¶
- func FormatFileContent(filePath string, content string) string
- func FormatFileResults(results []index.FileSearchResult, nameOnly bool) string
- func FormatSearchResults(results []index.ContentSearchResult, totalMatches int) string
- type FilesArgs
- type FilesHandler
- type ReadArgs
- type ReadHandler
- type ReindexArgs
- type ReindexFunc
- type ReindexHandler
- type SearchArgs
- type SearchHandler
- type StatusArgs
- type StatusHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFileContent ¶
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 ¶
FilesHandler holds the dependencies for the files tool.
func (*FilesHandler) Handle ¶
func (h *FilesHandler) Handle(ctx context.Context, req *mcp.CallToolRequest, args FilesArgs) (*mcp.CallToolResult, any, error)
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 ¶
func (h *ReadHandler) Handle(ctx context.Context, req *mcp.CallToolRequest, args ReadArgs) (*mcp.CallToolResult, any, error)
Handle processes a codeindex_read request.
type ReindexArgs ¶
type ReindexArgs struct{}
ReindexArgs defines the input parameters for the codeindex_reindex tool.
type ReindexFunc ¶
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 ¶
func (h *ReindexHandler) Handle(ctx context.Context, req *mcp.CallToolRequest, args ReindexArgs) (*mcp.CallToolResult, any, error)
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 ¶
func (h *SearchHandler) Handle(ctx context.Context, req *mcp.CallToolRequest, args SearchArgs) (*mcp.CallToolResult, any, error)
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 ¶
func (h *StatusHandler) Handle(ctx context.Context, req *mcp.CallToolRequest, args StatusArgs) (*mcp.CallToolResult, any, error)
Handle processes a codeindex_status request.