mcpserver

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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"
)
View Source
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.

const (
	// ActModeDryRun performs full preflight without injecting input.
	ActModeDryRun ActMode = "dry-run"
	// ActModeExecute permits execution, still subject to session policy and
	// per-action confirmation.
	ActModeExecute ActMode = "execute"
)

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

type CloseOutput struct {
	Closed bool       `json:"closed"`
	Error  *ToolError `json:"error,omitempty"`
}

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

type ObservationReleaseSession interface {
	Session
	ReleaseObservation(string) error
}

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 New

func New(session Session) (*Server, error)

New constructs a server without opening a transport or touching the desktop.

func NewWithOptions

func NewWithOptions(session Session, options Options) (*Server, error)

NewWithOptions constructs a server with explicit adapter-level grants.

func (*Server) Close

func (s *Server) Close() error

Close closes the underlying agent session. It is safe to call repeatedly and concurrently. Calls that start after close receive a stable error.

func (*Server) Run

func (s *Server) Run(ctx context.Context, transport mcp.Transport) (runErr error)

Run serves one persistent transport until the peer disconnects or ctx is canceled. The agent session is always closed before Run returns.

type Session

Session is the protocol-independent behavior consumed by the adapter. *agent.Session implements Session.

type ToolError

type ToolError struct {
	Code    agent.ErrorCode `json:"code"`
	Message string          `json:"message"`
}

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL