Documentation
¶
Overview ¶
Package mcpserver exposes an agent Session through a small, local-only MCP tool surface. Policy, validation, execution, and sensitive capture ownership remain in package agent.
Index ¶
- Constants
- type ActInput
- type ActMode
- type ActOutput
- type CapabilitiesOutput
- type CaptureOutput
- type CloseOutput
- type ElementActOutput
- type FindOutput
- type ImageAnalysisSession
- type ImageViewSession
- type InspectUIOutput
- type OCROutput
- type ObservationOutput
- type ObservationReleaseSession
- type ObserveOutput
- type Options
- type PlanFlowOutput
- type ReleaseObservationInput
- type ReleaseObservationOutput
- type ResolveUIOutput
- type SemanticActionSession
- type SemanticResolverSession
- type SemanticUISession
- type Server
- type Session
- type ToolError
- type VerifiedFlowPlannerSession
- type ViewOutput
- type VisualConditionSession
- type VisualElementsOutput
- type WaitOutput
Constants ¶
const ( // ToolFind evaluates a visual condition against one explicit observation. ToolFind = "robotgo_find" // ToolWait performs one policy-bounded visual wait over an explicit region. ToolWait = "robotgo_wait" // ToolReleaseObservation zeroes and removes one retained observation. ToolReleaseObservation = "robotgo_release_observation" )
const ( // ToolCapabilities reports the immutable operation catalog. ToolCapabilities = "robotgo_capabilities" // ToolObserve performs one policy-gated diagnostics or capture observation. ToolObserve = "robotgo_observe" // ToolView returns one explicitly enabled, policy-gated image observation. ToolView = "robotgo_view" // ToolOCR extracts bounded text boxes from a live image observation. ToolOCR = "robotgo_ocr" // ToolDetectElements proposes bounded visual regions from a live image observation. ToolDetectElements = "robotgo_detect_elements" // ToolInspectUI returns one bounded, privacy-reduced accessibility tree. ToolInspectUI = "robotgo_inspect_ui" // ToolResolveUI resolves one TargetSpec in a retained semantic observation. ToolResolveUI = "robotgo_resolve_ui" // ToolPlanFlow evaluates one bounded verified flow without side effects. ToolPlanFlow = "robotgo_plan_flow" // ToolElementAct executes one observation-bound native semantic action. ToolElementAct = "robotgo_element_act" // ToolAct plans or executes one typed action. ToolAct = "robotgo_act" // ToolClose closes the underlying RobotGo agent session. ToolClose = "robotgo_close" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActInput ¶
type ActInput struct {
Mode ActMode `json:"mode,omitempty"`
Request agent.ActionRequest `json:"request"`
}
ActInput is the strict input of robotgo_act. An omitted mode is dry-run.
type ActMode ¶
type ActMode string
ActMode controls whether robotgo_act only plans or actually executes.
type ActOutput ¶
type ActOutput struct {
Result *agent.ActionResult `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
ActOutput is the structured output of robotgo_act.
type CapabilitiesOutput ¶
type CapabilitiesOutput struct {
Catalog agent.OperationCatalog `json:"catalog"`
Error *ToolError `json:"error,omitempty"`
}
CapabilitiesOutput is the structured output of robotgo_capabilities.
type CaptureOutput ¶
type CaptureOutput struct {
Region agent.CaptureRegion `json:"region"`
Width int `json:"width"`
Height int `json:"height"`
}
CaptureOutput reports only geometry. The agent observation's pixels and lineage digest deliberately remain private to the in-process session.
type CloseOutput ¶
CloseOutput is the structured output of robotgo_close.
type ElementActOutput ¶
type ElementActOutput struct {
Result *agent.ActionResult `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
ElementActOutput is the payload-free result of robotgo_element_act.
type FindOutput ¶
type FindOutput struct {
Result *agent.FindColorResult `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
FindOutput is the privacy-reduced output of robotgo_find.
type ImageAnalysisSession ¶
type ImageAnalysisSession interface {
ImageViewSession
OCR(context.Context, agent.OCRRequest) (agent.OCRResult, error)
DetectVisualElements(context.Context, agent.VisualElementsRequest) (agent.VisualElementsResult, error)
}
ImageAnalysisSession is the additive, structured sensitive-read extension. Its results remain independently gated by the adapter image-content grant, immutable session policy, and a live desktop.view observation.
type ImageViewSession ¶
type ImageViewSession interface {
ObservationReleaseSession
View(context.Context, agent.ViewRequest) (*agent.View, error)
}
ImageViewSession is the additive sensitive-image extension. Merely implementing it does not expose pixels: server Options and session policy must independently opt in.
type InspectUIOutput ¶
type InspectUIOutput struct {
Observation *agent.UIObservation `json:"observation,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
InspectUIOutput is the structured output of robotgo_inspect_ui.
type OCROutput ¶
type OCROutput struct {
Result *agent.OCRResult `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
OCROutput is the structured output of robotgo_ocr.
type ObservationOutput ¶
type ObservationOutput struct {
SchemaVersion string `json:"schema_version"`
ObservationID string `json:"observation_id"`
CreatedAt time.Time `json:"created_at"`
Diagnostics agent.RuntimeDiagnostics `json:"diagnostics"`
Capture *CaptureOutput `json:"capture,omitempty"`
}
ObservationOutput is the privacy-reduced MCP projection of an observation.
type ObservationReleaseSession ¶
ObservationReleaseSession owns observation lifecycle independently of which observation producer a custom session implements.
type ObserveOutput ¶
type ObserveOutput struct {
Observation *ObservationOutput `json:"observation,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
ObserveOutput is the structured output of robotgo_observe.
type Options ¶
type Options struct {
AllowImageContent bool
}
Options contains immutable MCP adapter startup grants.
type PlanFlowOutput ¶
type PlanFlowOutput struct {
Plan *agent.VerifiedFlowPlanReport `json:"plan,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
PlanFlowOutput contains only the privacy-reduced advisory feasibility report.
type ReleaseObservationInput ¶
type ReleaseObservationInput struct {
ObservationID string `json:"observation_id"`
}
ReleaseObservationInput identifies session-owned capture state to zero.
type ReleaseObservationOutput ¶
type ReleaseObservationOutput struct {
Released bool `json:"released"`
Error *ToolError `json:"error,omitempty"`
}
ReleaseObservationOutput confirms that no retained observation with the requested ID remains. Releasing the same valid ID repeatedly is successful.
type ResolveUIOutput ¶
type ResolveUIOutput struct {
Result *agent.TargetResolutionResult `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
ResolveUIOutput returns one unique observation-bound semantic target or one stable payload-free error. Ambiguous results never contain element IDs.
type SemanticActionSession ¶
type SemanticActionSession interface {
SemanticUISession
ActUIElement(context.Context, agent.ElementActionRequest) (agent.ActionResult, error)
}
SemanticActionSession is the additive observation-bound semantic mutation extension. Implementations without it expose inspection but no element tool.
type SemanticResolverSession ¶
type SemanticResolverSession interface {
SemanticUISession
ResolveUITarget(context.Context, agent.ResolveUIRequest) (agent.TargetResolutionResult, error)
}
SemanticResolverSession is the additive, read-only TargetSpec resolver extension. It never grants mutation authority or calls a desktop backend.
type SemanticUISession ¶
type SemanticUISession interface {
ObservationReleaseSession
InspectUI(context.Context, agent.InspectUIRequest) (agent.UIObservation, error)
}
SemanticUISession is the additive accessibility observation extension.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server binds one process-exclusive agent session to one MCP connection.
func NewWithOptions ¶
NewWithOptions constructs a server with explicit adapter-level grants.
type Session ¶
type Session interface {
Catalog() agent.OperationCatalog
Observe(context.Context, agent.ObserveRequest) (*agent.Observation, error)
DryRun(context.Context, agent.ActionRequest) (agent.ActionResult, error)
Execute(context.Context, agent.ActionRequest) (agent.ActionResult, error)
Close() error
}
Session is the protocol-independent behavior consumed by the adapter. *agent.Session implements Session.
type ToolError ¶
ToolError is a stable, payload-free error returned in structured tool output. Unclassified backend error strings are never forwarded.
type VerifiedFlowPlannerSession ¶
type VerifiedFlowPlannerSession interface {
Session
PlanVerifiedFlow(context.Context, agent.VerifiedFlowPlanRequest) (agent.VerifiedFlowPlanReport, error)
}
VerifiedFlowPlannerSession is the additive advisory planning extension. It must not perform runtime discovery, prompt, audit, issue authority, or call a desktop backend.
type ViewOutput ¶
type ViewOutput struct {
View *agent.ViewMetadata `json:"view,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
ViewOutput is the pixel-free structured output paired with MCP image content. Image bytes exist only in CallToolResult.Content.
type VisualConditionSession ¶
type VisualConditionSession interface {
ObservationReleaseSession
FindColor(context.Context, agent.FindColorRequest) (agent.FindColorResult, error)
WaitColor(context.Context, agent.WaitColorRequest) (agent.WaitColorResult, error)
}
VisualConditionSession is the additive session extension used by the visual tools. Keeping it separate preserves source compatibility for existing Session implementations; implementations without the extension retain the original four-tool surface. *agent.Session implements VisualConditionSession.
type VisualElementsOutput ¶
type VisualElementsOutput struct {
Result *agent.VisualElementsResult `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
VisualElementsOutput is the structured output of robotgo_detect_elements.
type WaitOutput ¶
type WaitOutput struct {
Result *agent.WaitColorResult `json:"result,omitempty"`
Error *ToolError `json:"error,omitempty"`
}
WaitOutput is the privacy-reduced output of robotgo_wait.