Documentation
¶
Index ¶
- Constants
- func BranchAdapter(ctx context.Context, a *app.App, in BranchInput) (any, error)
- func Err(code, msg string, details map[string]any) error
- func ExecuteAdapter(ctx context.Context, a *app.App, in ExecuteInput) (any, error)
- func KillAdapter(ctx context.Context, a *app.App, in KillInput) (any, error)
- func RunAdapter(ctx context.Context, a *app.App, in RunInput) (any, error)
- func SetRateLimit(tool string, perMinute int)
- func StartServer(ctx context.Context, application *app.App, opts Options) error
- func StatusAdapter(ctx context.Context, a *app.App, in StatusInput) (any, error)
- type BranchInput
- type Error
- type ExecuteInput
- type KillInput
- type Options
- type RunInput
- type StatusInput
- type ToolMetricView
- type ToolMetrics
- type TunnelInput
Constants ¶
const ( E_INVALID = "E_INVALID" E_CONFIRM_REQUIRED = "E_CONFIRM_REQUIRED" E_NOT_FOUND = "E_NOT_FOUND" E_CONFLICT = "E_CONFLICT" E_INTERNAL = "E_INTERNAL" )
const ( TransportStdio = "stdio" TransportHTTP = "http" )
Variables ¶
This section is empty.
Functions ¶
func BranchAdapter ¶
BranchAdapter creates a VM branch and returns presenters.BranchView.
func ExecuteAdapter ¶
ExecuteAdapter runs a command in a VM and returns presenters.ExecuteView.
func KillAdapter ¶
KillAdapter deletes VMs per inputs. Returns nil output on success.
func RunAdapter ¶
RunAdapter starts a VM per inputs and returns a presenters.RunView.
func SetRateLimit ¶
SetRateLimit sets a simple per-minute limit for a given tool.
func StartServer ¶
StartServer wires the MCP server using the Go SDK when built with `-tags mcp`. Note: This file references the MCP Go SDK. Ensure the module is added:
go get github.com/modelcontextprotocol/go-sdk
API calls here are structured to match the SDK’s server + stdio transport.
func StatusAdapter ¶
StatusAdapter calls the existing status handler and returns the structured result.
Types ¶
type BranchInput ¶
type BranchInput struct {
Target string `json:"target,omitempty" jsonschema:"Source VM ID or alias; defaults to HEAD"`
Alias string `json:"alias,omitempty" jsonschema:"Alias for the new VM"`
Checkout bool `json:"checkout,omitempty" jsonschema:"Switch HEAD to the new VM after creation"`
Count int `json:"count,omitempty" jsonschema:"Number of branches to create (default 1)"`
}
BranchInput defines inputs for vers.branch
type ExecuteInput ¶
type ExecuteInput struct {
Target string `json:"target,omitempty" jsonschema:"VM ID or alias; defaults to HEAD"`
Command []string `json:"command" jsonschema:"Command and args to run"`
TimeoutSeconds int `json:"timeoutSeconds,omitempty" jsonschema:"Execution timeout in seconds"`
}
ExecuteInput defines inputs for vers.execute
type KillInput ¶
type KillInput struct {
Targets []string `json:"targets,omitempty" jsonschema:"VM identifiers; empty means HEAD VM"`
SkipConfirmation bool `json:"skipConfirmation,omitempty" jsonschema:"Required for destructive operations in MCP"`
Recursive bool `json:"recursive,omitempty" jsonschema:"Delete all descendants"`
}
KillInput defines inputs for vers.kill
type Options ¶
type Options struct {
// Transport selects the server transport. Supported: "stdio", "http".
Transport string
// Addr is the listen address for HTTP transport.
Addr string
// AllowInsecureSetKey toggles a local-only tool to set API key via MCP.
AllowInsecureSetKey bool
// Verbose enables extra debug logging.
Verbose bool
}
Options configures the MCP server startup.
type RunInput ¶
type RunInput struct {
MemSizeMib int64 `json:"memSizeMib,omitempty" jsonschema:"VM memory size in MiB"`
VcpuCount int64 `json:"vcpuCount,omitempty" jsonschema:"Number of vCPUs"`
RootfsName string `json:"rootfsName,omitempty" jsonschema:"Rootfs image name"`
KernelName string `json:"kernelName,omitempty" jsonschema:"Kernel image name"`
FsSizeVmMib int64 `json:"fsSizeVmMib,omitempty" jsonschema:"VM filesystem size in MiB"`
VMAlias string `json:"vmAlias,omitempty" jsonschema:"Alias for the root VM"`
}
RunInput defines inputs for vers.run
type StatusInput ¶
type StatusInput struct {
Target string `json:"target,omitempty" jsonschema:"VM ID or alias for VM-specific status"`
}
StatusInput is the input schema for vers.status tool.
type ToolMetricView ¶
type ToolMetricView struct {
Calls int64 `json:"calls"`
Errors int64 `json:"errors"`
TotalDurationMs int64 `json:"totalDurationMs"`
LastError string `json:"lastError,omitempty"`
RatePerMinute int `json:"ratePerMinute"`
UsedInWindow int `json:"usedInWindow"`
WindowResetSec int64 `json:"windowResetSec"`
}
ToolMetricView is a read-only view for reporting via vers.metrics.
type ToolMetrics ¶
type TunnelInput ¶ added in v0.6.0
type TunnelInput struct {
Target string `json:"target,omitempty" jsonschema:"VM ID or alias; defaults to HEAD"`
LocalPort int `json:"localPort" jsonschema:"Local port to listen on (0 for auto)"`
RemotePort int `json:"remotePort" jsonschema:"Remote port on the VM to forward to"`
RemoteHost string `json:"remoteHost,omitempty" jsonschema:"Remote host from the VM perspective; defaults to localhost"`
}
TunnelInput defines inputs for vers.tunnel