Documentation
¶
Index ¶
- Variables
- func GrepASTHandler(ctx context.Context, args GrepASTArgs) (*mcp.ToolResponse, error)
- func ReadFileHandler(ctx context.Context, args ReadFileArgs) (*mcp.ToolResponse, error)
- func ReplaceFileContentHandler(ctx context.Context, args ReplaceFileContentArgs) (*mcp.ToolResponse, error)
- func RepoMapHandler(ctx context.Context, args RepoMapArgs) (*mcp.ToolResponse, error)
- func RunCommandHandler(ctx context.Context, args RunCommandArgs) (*mcp.ToolResponse, error)
- func WriteToFileHandler(ctx context.Context, args WriteToFileArgs) (*mcp.ToolResponse, error)
- type GrepASTArgs
- type ReadFileArgs
- type ReplaceFileContentArgs
- type ReplacementChunk
- type RepoMapArgs
- type RunCommandArgs
- type Server
- type ServerOption
- type ToolInfo
- type WriteToFileArgs
Constants ¶
This section is empty.
Variables ¶
var GlobalServerOptions []ServerOption
GlobalServerOptions is a list of [ServerOption]s that are applied to all [Server]s.
Functions ¶
func GrepASTHandler ¶
func GrepASTHandler(ctx context.Context, args GrepASTArgs) (*mcp.ToolResponse, error)
GrepASTHandler handles the grepast tool
func ReadFileHandler ¶
func ReadFileHandler(ctx context.Context, args ReadFileArgs) (*mcp.ToolResponse, error)
ReadFileHandler handles the read_file tool
func ReplaceFileContentHandler ¶ added in v0.0.2
func ReplaceFileContentHandler(ctx context.Context, args ReplaceFileContentArgs) (*mcp.ToolResponse, error)
ReplaceFileContentHandler handles the replace_file_content tool
func RepoMapHandler ¶
func RepoMapHandler(ctx context.Context, args RepoMapArgs) (*mcp.ToolResponse, error)
RepoMapHandler handles the repomap tool
func RunCommandHandler ¶
func RunCommandHandler(ctx context.Context, args RunCommandArgs) (*mcp.ToolResponse, error)
RunCommandHandler handles the run_command tool
func WriteToFileHandler ¶ added in v0.0.2
func WriteToFileHandler(ctx context.Context, args WriteToFileArgs) (*mcp.ToolResponse, error)
WriteToFileHandler handles the write_to_file tool
Types ¶
type GrepASTArgs ¶
type GrepASTArgs struct { File string `json:"file" jsonschema:"required,description=File to process"` Pattern string `json:"pattern" jsonschema:"description=Pattern to search for"` IgnoreCase bool `json:"ignore_case" jsonschema:"description=Ignore case in search"` Color bool `json:"color" jsonschema:"description=Colorize output"` LineNumber bool `json:"line_number" jsonschema:"description=Show line numbers"` ParentContext bool `json:"parent_context" jsonschema:"description=Show parent context"` ChildContext bool `json:"child_context" jsonschema:"description=Show child context"` LastLine bool `json:"last_line" jsonschema:"description=Show last line of file"` Margin int `json:"margin" jsonschema:"description=Number of lines at the top of file to always show"` MarkLOIs bool `json:"mark_lois" jsonschema:"description=Mark lines of interest"` HeaderMax int `json:"header_max" jsonschema:"description=Maximum number of header lines to show"` ShowTopOfFile bool `json:"show_top_of_file" jsonschema:"description=Show parent context at top of file"` LOIPad int `json:"loi_pad" jsonschema:"description=Number of lines to pad around lines of interest"` }
GrepASTArgs defines the arguments for the grepast tool
type ReadFileArgs ¶
type ReadFileArgs struct {
Path string `json:"path" jsonschema:"required,description=Path to the file"`
}
ReadFileArgs defines the arguments for the read_file tool
type ReplaceFileContentArgs ¶ added in v0.0.2
type ReplaceFileContentArgs struct { TargetFile string `json:"target_file" jsonschema:"required,description=The absolute path to the file you want to edit"` ReplacementChunks []ReplacementChunk `json:"replacement_chunks" jsonschema:"required,description=An array of chunks to replace"` Instruction string `json:"instruction" jsonschema:"description=A description of the changes being made to the file"` }
ReplaceFileContentArgs defines the arguments for the replace_file_content tool. This tool edits an existing file by replacing specific chunks of text. The target_file must be an absolute path to an existing file. For each replacement chunk, you must specify the exact text to replace and its replacement.
type ReplacementChunk ¶ added in v0.0.2
type ReplacementChunk struct { TargetContent string `` /* 130-byte string literal not displayed */ ReplacementContent string `json:"replacement_content" jsonschema:"required,description=The content to replace the target with"` AllowMultiple bool `` /* 160-byte string literal not displayed */ }
ReplacementChunk defines a single replacement operation
type RepoMapArgs ¶
type RepoMapArgs struct { Path string `json:"path" jsonschema:"description=Path to the repository to map"` MaxDepth int `json:"max_depth" jsonschema:"description=Maximum directory depth to traverse"` Renderer string `json:"renderer" jsonschema:"description=Output renderer to use (default, legacy, grepast)"` MaxTokens int `json:"max_tokens" jsonschema:"description=Maximum number of tokens for the output"` FocusFiles []string `json:"focus_files" jsonschema:"description=Files that have user's focus (will be prioritized in the output)"` MentionedIds []string `json:"mentioned_ids" jsonschema:"description=Identifiers that were explicitly mentioned (will be prioritized in the output)"` IgnoreDirs []string `json:"ignore_dirs" jsonschema:"description=Directories to ignore during traversal"` IgnoreFiles []string `json:"ignore_files" jsonschema:"description=Files to ignore during traversal"` IncludeFiles []string `json:"include_files" jsonschema:"description=File patterns to include (e.g., '.go', '.py')"` }
RepoMapArgs defines the arguments for the repomap tool
type RunCommandArgs ¶
type RunCommandArgs struct {
Command string `json:"command" jsonschema:"required,description=Command to execute in bash"`
}
RunCommandArgs defines the arguments for the run_command tool
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents an MCP server with stdio transport
func NewServer ¶
func NewServer(options ...ServerOption) (*Server, error)
NewServer creates a new MCP server with stdio transport
func (*Server) ServeStdio ¶
ServeStdio starts the server and serves requests from stdin and writes responses to stdout
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
ServerOption is an option for configuring a Server.
func WithServerLogger ¶
func WithServerLogger(logger *slog.Logger) ServerOption
WithServerLogger returns a ServerOption that uses the provided logger.
func WithServerVersion ¶
func WithServerVersion(version string) ServerOption
WithServerVersion returns a ServerOption that uses the provided version.
func WithTools ¶
func WithTools(tools []string) ServerOption
WithTools returns a ServerOption that specifies which tools to register.
type ToolInfo ¶
ToolInfo represents information about a tool
func GetAvailableTools ¶
func GetAvailableTools() []ToolInfo
GetAvailableTools returns a list of all available tools that can be registered with the server
type WriteToFileArgs ¶ added in v0.0.2
type WriteToFileArgs struct { TargetFile string `json:"target_file" jsonschema:"required,description=Absolute path to the file to write to"` Content string `json:"content" jsonschema:"required,description=Content to write to the file"` Empty bool `json:"empty" jsonschema:"required,description=If true, empty file is created"` }
WriteToFileArgs defines the arguments for the write_to_file tool. This tool creates a file at the specified path and writes content to it. If the empty flag is set, it creates an empty file. The target_file must be an absolute path. Any missing directories in the path will be created. Cannot be used to write to existing files.