Documentation
¶
Index ¶
- Constants
- func RegisterAll(server *mcp.Server, resolver *pathscope.Resolver, sess *session.Session, ...)
- func ValidateDisableTools(names map[string]struct{}, anthropicCompat bool) error
- type BashArgs
- type Config
- type CreateFileArgs
- type EditorCommand
- type GlobArgs
- type GlobCompatArgs
- type GrepArgs
- type GrepCompatArgs
- type StrReplaceArgs
- type StrReplaceEditorArgs
- type TaskOutputArgs
- type ViewArgs
- type ViewRange
Constants ¶
const ( ErrInvalidInput = "INVALID_INPUT" ErrPathNotFound = "PATH_NOT_FOUND" ErrAccessDenied = "ACCESS_DENIED" ErrFileTooLarge = "FILE_TOO_LARGE" ErrIO = "IO_ERROR" )
Error code constants for structured error responses. Cross-tool codes
const ( ErrBashEmptyCommand = "BASH_EMPTY_COMMAND" ErrBashStartFailed = "BASH_START_FAILED" ErrBashTaskLimit = "BASH_TASK_LIMIT" ErrBashTaskNotFound = "BASH_TASK_NOT_FOUND" )
Bash tool codes
const ( ErrStrReplaceNotFound = "STR_REPLACE_NOT_FOUND" ErrStrReplaceAmbiguous = "STR_REPLACE_AMBIGUOUS" )
Str_replace tool codes
const ( ErrGrepInvalidPattern = "GREP_INVALID_PATTERN" ErrGrepInvalidOutputMode = "GREP_INVALID_OUTPUT_MODE" )
Grep tool codes
const ( ErrGlobInvalidPattern = "GLOB_INVALID_PATTERN" ErrGlobInvalidType = "GLOB_INVALID_TYPE" )
Glob tool codes
const (
ErrFileNotViewed = "FILE_NOT_VIEWED"
)
View-before-edit codes
Variables ¶
This section is empty.
Functions ¶
func RegisterAll ¶
func RegisterAll(server *mcp.Server, resolver *pathscope.Resolver, sess *session.Session, cfg Config)
RegisterAll registers all tools with the MCP server.
func ValidateDisableTools ¶
ValidateDisableTools checks that all tool names in the set are valid for the given mode.
Types ¶
type BashArgs ¶
type BashArgs struct {
Command string `json:"command" jsonschema:"the shell command to execute"`
Timeout int `json:"timeout,omitempty" jsonschema:"timeout in milliseconds (default 120000, max 600000)"`
RunInBackground bool `json:"run_in_background,omitempty" jsonschema:"run command in background, returns a task_id"`
Description string `json:"description,omitempty" jsonschema:"optional human-readable description of what this command does"`
}
BashArgs is the input schema for the bash tool.
type Config ¶
type Config struct {
DisableTools map[string]struct{}
MaxFileSize int64
DefaultTimeout int
Shell string
AnthropicCompat bool
BackgroundTaskTimeout int // background task safety-net timeout in seconds (0 = disabled)
RequireViewBeforeEdit bool
// RegisterSession is called on first bash/task_output invocation with the
// SDK session ID. In HTTP mode this registers the Boris session in the
// SessionRegistry for lifecycle cleanup. Nil in STDIO mode.
RegisterSession func(sessionID string)
}
Config holds configuration for tool registration.
type CreateFileArgs ¶
type CreateFileArgs struct {
Path string `json:"path" jsonschema:"file path to create or overwrite"`
Content string `json:"content" jsonschema:"file content"`
}
CreateFileArgs is the input schema for the create_file tool.
type EditorCommand ¶
type EditorCommand string
EditorCommand is the command type for the combined str_replace_editor tool.
const ( EditorCommandView EditorCommand = "view" EditorCommandStrReplace EditorCommand = "str_replace" EditorCommandCreate EditorCommand = "create" )
type GlobArgs ¶
type GlobArgs struct {
Pattern string `json:"pattern" jsonschema:"the glob pattern to match files against,required"`
Path string `json:"path,omitempty" jsonschema:"the directory to search in (defaults to cwd)"`
Type string `json:"type,omitempty" jsonschema:"filter by type: file or directory"`
}
GlobArgs is the input schema for the glob tool (normal MCP mode).
type GlobCompatArgs ¶
type GlobCompatArgs struct {
Pattern string `json:"pattern" jsonschema:"the glob pattern to match files against,required"`
Path string `` /* 307-byte string literal not displayed */
}
GlobCompatArgs is the input schema for the glob tool in --anthropic-compat mode.
type GrepArgs ¶
type GrepArgs struct {
Pattern string `json:"pattern" jsonschema:"the regex pattern to search for in file contents,required"`
Path string `json:"path,omitempty" jsonschema:"file or directory to search in (defaults to cwd)"`
Include string `json:"include,omitempty" jsonschema:"glob pattern to filter files (e.g. '*.js' or '*.{ts,tsx}')"`
Type string `json:"type,omitempty" jsonschema:"file type to search (e.g. js, py, go, ts)"`
OutputMode string `json:"output_mode,omitempty" jsonschema:"output mode: content, files_with_matches (default), or count"`
CaseInsensitive bool `json:"case_insensitive,omitempty" jsonschema:"case-insensitive search"`
LineNumbers *bool `json:"line_numbers,omitempty" jsonschema:"show line numbers in content mode (default true)"`
Multiline bool `json:"multiline,omitempty" jsonschema:"enable multiline mode where . matches newlines"`
HeadLimit int `json:"head_limit,omitempty" jsonschema:"limit output to first N results (0 = unlimited)"`
Offset int `json:"offset,omitempty" jsonschema:"skip first N results before applying head_limit"`
ContextBefore *int `json:"context_before,omitempty" jsonschema:"number of lines to show before each match"`
ContextAfter *int `json:"context_after,omitempty" jsonschema:"number of lines to show after each match"`
Context *int `json:"context,omitempty" jsonschema:"number of lines to show before and after each match"`
}
GrepArgs is the input schema for the grep tool (normal MCP mode).
type GrepCompatArgs ¶
type GrepCompatArgs struct {
Pattern string `json:"pattern" jsonschema:"the regex pattern to search for in file contents,required"`
Path string `json:"path,omitempty" jsonschema:"file or directory to search in (defaults to cwd)"`
Glob string `json:"glob,omitempty" jsonschema:"glob pattern to filter files (e.g. '*.js' or '*.{ts,tsx}')"`
Type string `json:"type,omitempty" jsonschema:"file type to search (e.g. js, py, go, ts)"`
OutputMode string `json:"output_mode,omitempty" jsonschema:"output mode: content, files_with_matches (default), or count"`
I bool `json:"-i,omitempty" jsonschema:"case-insensitive search"`
N *bool `json:"-n,omitempty" jsonschema:"show line numbers in content mode (default true)"`
Multiline bool `json:"multiline,omitempty" jsonschema:"enable multiline mode where . matches newlines"`
HeadLimit int `json:"head_limit,omitempty" jsonschema:"limit output to first N results (0 = unlimited)"`
Offset int `json:"offset,omitempty" jsonschema:"skip first N results before applying head_limit"`
B *int `json:"-B,omitempty" jsonschema:"number of lines to show before each match"`
A *int `json:"-A,omitempty" jsonschema:"number of lines to show after each match"`
C *int `json:"-C,omitempty" jsonschema:"number of lines to show before and after each match"`
ContextAlias *int `json:"context,omitempty" jsonschema:"alias for -C"`
}
GrepCompatArgs is the input schema for the grep tool in --anthropic-compat mode.
type StrReplaceArgs ¶
type StrReplaceArgs struct {
Path string `json:"path" jsonschema:"file path"`
OldStr string `json:"old_str" jsonschema:"the string to find (must be unique unless replace_all is true)"`
NewStr string `json:"new_str,omitempty" jsonschema:"replacement string (empty or omitted to delete)"`
ReplaceAll bool `json:"replace_all,omitempty" jsonschema:"replace all occurrences instead of requiring a unique match"`
}
StrReplaceArgs is the input schema for the str_replace tool.
type StrReplaceEditorArgs ¶
type StrReplaceEditorArgs struct {
Command EditorCommand `json:"command" jsonschema:"the operation to perform: view, str_replace, or create"`
Path string `json:"path" jsonschema:"file path"`
ViewRange ViewRange `json:"view_range,omitempty" jsonschema:"optional line range [start end] (1-indexed, for view command)"`
OldStr string `json:"old_str,omitempty" jsonschema:"the string to find (for str_replace command)"`
NewStr string `json:"new_str,omitempty" jsonschema:"replacement string (for str_replace command)"`
ReplaceAll bool `json:"replace_all,omitempty" jsonschema:"replace all occurrences (for str_replace command)"`
FileText string `json:"file_text,omitempty" jsonschema:"file content (for create command)"`
}
StrReplaceEditorArgs is the input schema for the combined str_replace_editor tool.
type TaskOutputArgs ¶
type TaskOutputArgs struct {
TaskID string `json:"task_id" jsonschema:"the task ID returned by a background bash command"`
}
TaskOutputArgs is the input schema for the task_output tool.