Documentation
¶
Index ¶
- Constants
- Variables
- type CommandExecutor
- type Curl
- type CurlConfig
- type DBConnection
- type Docker
- type DockerConfig
- type FileSystem
- type FileSystemConfig
- type Git
- type GitConfig
- type GitHub
- type GitHubConfig
- type MockLogger
- func (m *MockLogger) Debug(args ...interface{})
- func (m *MockLogger) Debugf(format string, args ...interface{})
- func (m *MockLogger) Error(args ...interface{})
- func (m *MockLogger) Errorf(format string, args ...interface{})
- func (m *MockLogger) Fatal(args ...interface{})
- func (m *MockLogger) Fatalf(format string, args ...interface{})
- func (m *MockLogger) Info(args ...interface{})
- func (m *MockLogger) Infof(format string, args ...interface{})
- func (m *MockLogger) Panic(args ...interface{})
- func (m *MockLogger) Panicf(format string, args ...interface{})
- func (m *MockLogger) Warn(args ...interface{})
- func (m *MockLogger) Warnf(format string, args ...interface{})
- func (m *MockLogger) WithContext(ctx context.Context) observability.Logger
- func (m *MockLogger) WithErr(err error) observability.Logger
- func (m *MockLogger) WithFields(fields map[string]interface{}) observability.Logger
- type PostgreSQL
- type PostgreSQLConfig
- type RealCommandExecutor
Constants ¶
const ( GitHubIssuesToolName = "github_issues" GitHubPullRequestsToolName = "github_pull_requests" GitHubRepositoryToolName = "github_repository" GitHubSearchToolName = "github_search" )
const CurlToolName = "curl_all_in_one"
const DockerToolName = "docker_all_in_one"
const FileSystemToolName = "filesystem_all_in_one"
const GitToolName = "git_all_in_one"
const PostgreSQLToolName = "postgresql_all_in_one"
PostgreSQLToolName is the name of the PostgreSQL tool
Variables ¶
var GetWeather = mcp.Tool{ Name: "get_weather", Description: "Get the current weather for a given location.", InputSchema: json.RawMessage(`{ "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g. San Francisco, CA" } }, "required": ["location"] }`), Handler: func(ctx context.Context, params mcp.CallToolParams) (mcp.CallToolResult, error) { _, span := observability.StartSpan(ctx, fmt.Sprintf("%s.Handler", params.Name)) span.SetAttributes( attribute.String("tool_name", params.Name), attribute.String("tool_argument", string(params.Arguments)), ) defer span.End() var err error defer func() { if err != nil { span.RecordError(err) } }() var input struct { Location string `json:"location"` } if err := json.Unmarshal(params.Arguments, &input); err != nil { return mcp.CallToolResult{}, err } return mcp.CallToolResult{ Content: []mcp.ToolResultContent{ { Type: "text", Text: fmt.Sprintf("Weather in %s: Sunny, 72°F", input.Location), }, }, }, nil }, }
GetWeather is a tool that provides the current weather for a specified location. The tool expects an input schema that includes a "location" field, which specifies the city and state (e.g., "San Francisco, CA"). It returns the weather information as text content.
Functions ¶
This section is empty.
Types ¶
type CommandExecutor ¶
type CommandExecutor interface {
ExecuteCommand(ctx context.Context, cmd *exec.Cmd) ([]byte, error)
}
CommandExecutor interface for executing commands
type Curl ¶
type Curl struct {
// contains filtered or unexported fields
}
Curl represents a wrapper around the system's curl command-line tool, providing a programmatic interface for making HTTP requests.
func NewCurl ¶
func NewCurl(logger observability.Logger, config CurlConfig) *Curl
NewCurl creates and returns a new instance of the Curl wrapper with the provided configuration.
func (*Curl) CurlAllInOneTool ¶
CurlAllInOneTool returns a mcp.Tool that can perform various HTTP requests
type CurlConfig ¶
type CurlConfig struct {
BlockedMethods []string
}
CurlConfig holds the configuration for the Curl tool
type DBConnection ¶
type DBConnection struct {
Host string
Port string
User string
Password string
DBName string
SSLMode string
}
DBConnection represents a PostgreSQL database connection configuration
type Docker ¶
type Docker struct {
// contains filtered or unexported fields
}
Docker represents a wrapper around the system's docker command-line tool
func NewDocker ¶
func NewDocker(logger observability.Logger) *Docker
NewDocker creates and returns a new instance of the Docker wrapper
func (*Docker) DockerAllInOneTool ¶
DockerAllInOneTool returns a mcp.Tool that can execute Docker commands
type DockerConfig ¶
type DockerConfig struct {
}
DockerConfig holds the configuration for the Docker tool
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
FileSystem represents a wrapper around filesystem operations
func NewFileSystem ¶
func NewFileSystem(logger observability.Logger, config FileSystemConfig) *FileSystem
NewFileSystem creates a new instance of FileSystem
func (*FileSystem) FileSystemAllInOneTool ¶
func (fs *FileSystem) FileSystemAllInOneTool() mcp.Tool
FileSystemAllInOneTool returns a Tool that performs filesystem operations
type FileSystemConfig ¶
type FileSystemConfig struct {
AllowedDirectory string // Base directory for all operations
BlockedPatterns []string // Patterns to block (e.g., "*.exe", "*.dll")
}
FileSystemConfig holds the configuration for the FileSystem tool
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
Git represents a wrapper around the system's git command-line tool, providing a programmatic interface for executing git commands.
func NewGit ¶
func NewGit(logger observability.Logger, config GitConfig) *Git
NewGit creates and returns a new instance of the Git wrapper with the provided configuration.
func (*Git) GitAllInOneTool ¶
GitAllInOneTool returns a mcp.Tool that can perform various Git operations
type GitConfig ¶
type GitConfig struct {
// Add any configuration options here
// For example, you might want to add:
DefaultRepoPath string
BlockedCommands []string
}
GitConfig holds the configuration for the Git tool
type GitHub ¶
type GitHub struct {
// contains filtered or unexported fields
}
GitHub represents a wrapper around GitHub API client
func NewGitHubTool ¶
func NewGitHubTool(logger observability.Logger, config GitHubConfig) *GitHub
NewGitHubTool to perform operations on GitHub
func (*GitHub) GetIssuesTool ¶
GetIssuesTool returns a tool for managing GitHub issues
func (*GitHub) GetPullRequestsTool ¶
GetPullRequestsTool returns a tool for managing GitHub pull requests
func (*GitHub) GetRepositoryTool ¶
GetRepositoryTool returns a tool for managing GitHub repositories
func (*GitHub) GetSearchTool ¶
GetSearchTool returns a tool for GitHub search operations
type GitHubConfig ¶
type GitHubConfig struct {
Token string
}
type MockLogger ¶
MockLogger is a mock implementation of observability.Logger
func (*MockLogger) Debug ¶
func (m *MockLogger) Debug(args ...interface{})
Debug logs a debug message.
func (*MockLogger) Debugf ¶
func (m *MockLogger) Debugf(format string, args ...interface{})
Debugf logs a formatted debug message.
func (*MockLogger) Error ¶
func (m *MockLogger) Error(args ...interface{})
Error logs an error message.
func (*MockLogger) Errorf ¶
func (m *MockLogger) Errorf(format string, args ...interface{})
Errorf logs a formatted error message.
func (*MockLogger) Fatal ¶
func (m *MockLogger) Fatal(args ...interface{})
Fatal logs a fatal message.
func (*MockLogger) Fatalf ¶
func (m *MockLogger) Fatalf(format string, args ...interface{})
Fatalf logs a formatted fatal message.
func (*MockLogger) Infof ¶
func (m *MockLogger) Infof(format string, args ...interface{})
Infof logs a formatted info message.
func (*MockLogger) Panic ¶
func (m *MockLogger) Panic(args ...interface{})
Panic logs a panic message.
func (*MockLogger) Panicf ¶
func (m *MockLogger) Panicf(format string, args ...interface{})
Panicf logs a formatted panic message.
func (*MockLogger) Warn ¶
func (m *MockLogger) Warn(args ...interface{})
Warn logs a warning message.
func (*MockLogger) Warnf ¶
func (m *MockLogger) Warnf(format string, args ...interface{})
Warnf logs a formatted warning message.
func (*MockLogger) WithContext ¶
func (m *MockLogger) WithContext(ctx context.Context) observability.Logger
WithContext adds a context to the logger and returns a new logger instance.
func (*MockLogger) WithErr ¶
func (m *MockLogger) WithErr(err error) observability.Logger
WithErr adds an error to the logger and returns a new logger instance.
func (*MockLogger) WithFields ¶
func (m *MockLogger) WithFields(fields map[string]interface{}) observability.Logger
WithFields adds fields to the logger and returns a new logger instance.
type PostgreSQL ¶
type PostgreSQL struct {
// contains filtered or unexported fields
}
PostgreSQL represents a tool for performing PostgreSQL operations
func NewPostgreSQL ¶
func NewPostgreSQL(logger observability.Logger, config PostgreSQLConfig) *PostgreSQL
NewPostgreSQL creates a new PostgreSQL tool with the given logger and configuration
func (*PostgreSQL) PostgreSQLAllInOneTool ¶
func (p *PostgreSQL) PostgreSQLAllInOneTool() mcp.Tool
PostgreSQLAllInOneTool remains mostly the same, but uses getConnection instead
type PostgreSQLConfig ¶
PostgreSQLConfig represents the configuration for the PostgreSQL tool
type RealCommandExecutor ¶
type RealCommandExecutor struct{}
RealCommandExecutor implements CommandExecutor for real command execution