mcp

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mcp provides an MCP (Model Context Protocol) server for browser automation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddScriptInput

type AddScriptInput struct {
	Source string `json:"source" jsonschema:"description=JavaScript source to inject,required"`
}

type AddScriptOutput

type AddScriptOutput struct {
	Message string `json:"message"`
}

type AddStyleInput

type AddStyleInput struct {
	Source string `json:"source" jsonschema:"description=CSS source to inject,required"`
}

type AddStyleOutput

type AddStyleOutput struct {
	Message string `json:"message"`
}

type AssertElementInput

type AssertElementInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type AssertElementOutput

type AssertElementOutput struct {
	Found   bool   `json:"found"`
	Message string `json:"message"`
}

type AssertTextInput

type AssertTextInput struct {
	Text     string `json:"text" jsonschema:"description=Text to search for,required"`
	Selector string `json:"selector" jsonschema:"description=Optional: limit search to element matching selector"`
}

type AssertTextOutput

type AssertTextOutput struct {
	Found   bool   `json:"found"`
	Message string `json:"message"`
}

type BackInput

type BackInput struct{}

type BackOutput

type BackOutput struct {
	Message string `json:"message"`
}

type BringToFrontInput

type BringToFrontInput struct{}

type BringToFrontOutput

type BringToFrontOutput struct {
	Message string `json:"message"`
}

type BrowserLaunchInput

type BrowserLaunchInput struct {
	Headless bool `json:"headless" jsonschema:"description=Run browser without GUI (default: true)"`
}

type BrowserLaunchOutput

type BrowserLaunchOutput struct {
	Message string `json:"message"`
}

type BrowserQuitInput

type BrowserQuitInput struct{}

type BrowserQuitOutput

type BrowserQuitOutput struct {
	Message string `json:"message"`
}

type CheckInput

type CheckInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the checkbox,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type CheckOutput

type CheckOutput struct {
	Message string `json:"message"`
}

type ClearCookiesInput

type ClearCookiesInput struct{}

type ClearCookiesOutput

type ClearCookiesOutput struct {
	Message string `json:"message"`
}

type ClearInput

type ClearInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the input element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type ClearOutput

type ClearOutput struct {
	Message string `json:"message"`
}

type ClearRecordingInput

type ClearRecordingInput struct{}

type ClearRecordingOutput

type ClearRecordingOutput struct {
	Message string `json:"message"`
}

type ClickInput

type ClickInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element to click,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type ClickOutput

type ClickOutput struct {
	Message string `json:"message"`
}

type ClosePageInput

type ClosePageInput struct{}

type ClosePageOutput

type ClosePageOutput struct {
	Message string `json:"message"`
}

type Config

type Config struct {
	// Headless runs the browser without a GUI.
	Headless bool

	// Project is the project name for reports.
	Project string

	// DefaultTimeout is the default timeout for browser operations.
	DefaultTimeout time.Duration
}

Config holds server configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with sensible defaults.

type CookieOutput

type CookieOutput struct {
	Name     string  `json:"name"`
	Value    string  `json:"value"`
	Domain   string  `json:"domain"`
	Path     string  `json:"path"`
	Expires  float64 `json:"expires"`
	HTTPOnly bool    `json:"httpOnly"`
	Secure   bool    `json:"secure"`
	SameSite string  `json:"sameSite"`
}

type DblClickInput

type DblClickInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type DblClickOutput

type DblClickOutput struct {
	Message string `json:"message"`
}

type DispatchEventInput

type DispatchEventInput struct {
	Selector  string         `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	EventType string         `json:"event_type" jsonschema:"description=Event type (e.g. click focus blur),required"`
	EventInit map[string]any `json:"event_init" jsonschema:"description=Event initialization options"`
	TimeoutMS int            `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type DispatchEventOutput

type DispatchEventOutput struct {
	Message string `json:"message"`
}

type DragToInput

type DragToInput struct {
	SourceSelector string `json:"source_selector" jsonschema:"description=CSS selector for the element to drag,required"`
	TargetSelector string `json:"target_selector" jsonschema:"description=CSS selector for the drop target,required"`
	TimeoutMS      int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type DragToOutput

type DragToOutput struct {
	Message string `json:"message"`
}

type ElementEvalInput

type ElementEvalInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	Function  string `json:"function" jsonschema:"description=JavaScript function (receives element as first arg),required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type ElementEvalOutput

type ElementEvalOutput struct {
	Result any `json:"result"`
}

type ElementScreenshotInput

type ElementScreenshotInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type ElementScreenshotOutput

type ElementScreenshotOutput struct {
	Data string `json:"data"`
}

type EmulateMediaInput

type EmulateMediaInput struct {
	Media         string `json:"media" jsonschema:"description=Media type: screen print or empty"`
	ColorScheme   string `json:"color_scheme" jsonschema:"description=Color scheme: light dark no-preference or empty"`
	ReducedMotion string `json:"reduced_motion" jsonschema:"description=Reduced motion: reduce no-preference or empty"`
}

type EmulateMediaOutput

type EmulateMediaOutput struct {
	Message string `json:"message"`
}

type EvaluateInput

type EvaluateInput struct {
	Script string `json:"script" jsonschema:"description=JavaScript to execute,required"`
}

type EvaluateOutput

type EvaluateOutput struct {
	Result any `json:"result"`
}

type ExportScriptInput

type ExportScriptInput struct {
	Format string `json:"format,omitempty" jsonschema:"description=Output format: json or yaml (default: json),enum=json,enum=yaml"`
}

type ExportScriptOutput

type ExportScriptOutput struct {
	Script    string `json:"script"`
	StepCount int    `json:"stepCount"`
	Format    string `json:"format"`
}

type FillInput

type FillInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the input element,required"`
	Value     string `json:"value" jsonschema:"description=Value to fill,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type FillOutput

type FillOutput struct {
	Message string `json:"message"`
}

type FocusInput

type FocusInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type FocusOutput

type FocusOutput struct {
	Message string `json:"message"`
}

type ForwardInput

type ForwardInput struct{}

type ForwardOutput

type ForwardOutput struct {
	Message string `json:"message"`
}

type FrameInfoOutput

type FrameInfoOutput struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

type GetAttributeInput

type GetAttributeInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	Name      string `json:"name" jsonschema:"description=Attribute name,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetAttributeOutput

type GetAttributeOutput struct {
	Value string `json:"value"`
}

type GetBoundingBoxInput

type GetBoundingBoxInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetBoundingBoxOutput

type GetBoundingBoxOutput struct {
	X      float64 `json:"x"`
	Y      float64 `json:"y"`
	Width  float64 `json:"width"`
	Height float64 `json:"height"`
}

type GetContentInput

type GetContentInput struct{}

type GetContentOutput

type GetContentOutput struct {
	Content string `json:"content"`
}

type GetCookiesInput

type GetCookiesInput struct {
	URLs []string `json:"urls" jsonschema:"description=URLs to get cookies for (optional)"`
}

type GetCookiesOutput

type GetCookiesOutput struct {
	Cookies []CookieOutput `json:"cookies"`
}

type GetFramesInput

type GetFramesInput struct{}

type GetFramesOutput

type GetFramesOutput struct {
	Frames []FrameInfoOutput `json:"frames"`
}

type GetInnerHTMLInput

type GetInnerHTMLInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetInnerHTMLOutput

type GetInnerHTMLOutput struct {
	HTML string `json:"html"`
}

type GetInnerTextInput

type GetInnerTextInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetInnerTextOutput

type GetInnerTextOutput struct {
	Text string `json:"text"`
}

type GetLabelInput

type GetLabelInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetLabelOutput

type GetLabelOutput struct {
	Label string `json:"label"`
}

type GetPagesInput

type GetPagesInput struct{}

type GetPagesOutput

type GetPagesOutput struct {
	Count int `json:"count"`
}

type GetRoleInput

type GetRoleInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetRoleOutput

type GetRoleOutput struct {
	Role string `json:"role"`
}

type GetStorageStateInput

type GetStorageStateInput struct{}

type GetStorageStateOutput

type GetStorageStateOutput struct {
	State string `json:"state"`
}

type GetTestReportInput

type GetTestReportInput struct {
	Format string `` /* 156-byte string literal not displayed */
}

type GetTestReportOutput

type GetTestReportOutput struct {
	Report string `json:"report"`
}

type GetTextInput

type GetTextInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetTextOutput

type GetTextOutput struct {
	Text string `json:"text"`
}

type GetTitleInput

type GetTitleInput struct{}

type GetTitleOutput

type GetTitleOutput struct {
	Title string `json:"title"`
}

type GetURLInput

type GetURLInput struct{}

type GetURLOutput

type GetURLOutput struct {
	URL string `json:"url"`
}

type GetValueInput

type GetValueInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the input element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type GetValueOutput

type GetValueOutput struct {
	Value string `json:"value"`
}

type GetViewportInput

type GetViewportInput struct{}

type GetViewportOutput

type GetViewportOutput struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

type HoverInput

type HoverInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type HoverOutput

type HoverOutput struct {
	Message string `json:"message"`
}

type IsCheckedInput

type IsCheckedInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the checkbox/radio,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type IsCheckedOutput

type IsCheckedOutput struct {
	Checked bool `json:"checked"`
}

type IsEditableInput

type IsEditableInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type IsEditableOutput

type IsEditableOutput struct {
	Editable bool `json:"editable"`
}

type IsEnabledInput

type IsEnabledInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type IsEnabledOutput

type IsEnabledOutput struct {
	Enabled bool `json:"enabled"`
}

type IsHiddenInput

type IsHiddenInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type IsHiddenOutput

type IsHiddenOutput struct {
	Hidden bool `json:"hidden"`
}

type IsVisibleInput

type IsVisibleInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type IsVisibleOutput

type IsVisibleOutput struct {
	Visible bool `json:"visible"`
}

type KeyboardDownInput

type KeyboardDownInput struct {
	Key string `json:"key" jsonschema:"description=Key to hold down,required"`
}

type KeyboardDownOutput

type KeyboardDownOutput struct {
	Message string `json:"message"`
}

type KeyboardPressInput

type KeyboardPressInput struct {
	Key string `json:"key" jsonschema:"description=Key to press (e.g. Enter Tab ArrowDown),required"`
}

type KeyboardPressOutput

type KeyboardPressOutput struct {
	Message string `json:"message"`
}

type KeyboardTypeInput

type KeyboardTypeInput struct {
	Text string `json:"text" jsonschema:"description=Text to type,required"`
}

type KeyboardTypeOutput

type KeyboardTypeOutput struct {
	Message string `json:"message"`
}

type KeyboardUpInput

type KeyboardUpInput struct {
	Key string `json:"key" jsonschema:"description=Key to release,required"`
}

type KeyboardUpOutput

type KeyboardUpOutput struct {
	Message string `json:"message"`
}

type MouseClickInput

type MouseClickInput struct {
	X          float64 `json:"x" jsonschema:"description=X coordinate,required"`
	Y          float64 `json:"y" jsonschema:"description=Y coordinate,required"`
	Button     string  `json:"button" jsonschema:"description=Mouse button: left right middle"`
	ClickCount int     `json:"click_count" jsonschema:"description=Number of clicks (default: 1)"`
}

type MouseClickOutput

type MouseClickOutput struct {
	Message string `json:"message"`
}

type MouseDownInput

type MouseDownInput struct {
	Button string `json:"button" jsonschema:"description=Mouse button: left right middle"`
}

type MouseDownOutput

type MouseDownOutput struct {
	Message string `json:"message"`
}

type MouseMoveInput

type MouseMoveInput struct {
	X float64 `json:"x" jsonschema:"description=X coordinate,required"`
	Y float64 `json:"y" jsonschema:"description=Y coordinate,required"`
}

type MouseMoveOutput

type MouseMoveOutput struct {
	Message string `json:"message"`
}

type MouseUpInput

type MouseUpInput struct {
	Button string `json:"button" jsonschema:"description=Mouse button: left right middle"`
}

type MouseUpOutput

type MouseUpOutput struct {
	Message string `json:"message"`
}

type MouseWheelInput

type MouseWheelInput struct {
	DeltaX float64 `json:"delta_x" jsonschema:"description=Horizontal scroll amount"`
	DeltaY float64 `json:"delta_y" jsonschema:"description=Vertical scroll amount"`
}

type MouseWheelOutput

type MouseWheelOutput struct {
	Message string `json:"message"`
}
type NavigateInput struct {
	URL string `json:"url" jsonschema:"description=The URL to navigate to,required"`
}
type NavigateOutput struct {
	URL   string `json:"url"`
	Title string `json:"title"`
}

type NewPageInput

type NewPageInput struct{}

type NewPageOutput

type NewPageOutput struct {
	Message string `json:"message"`
}

type PDFInput

type PDFInput struct {
	Scale           float64 `json:"scale" jsonschema:"description=Scale of the PDF (default: 1)"`
	PrintBackground bool    `json:"print_background" jsonschema:"description=Print background graphics"`
	Landscape       bool    `json:"landscape" jsonschema:"description=Landscape orientation"`
	Format          string  `json:"format" jsonschema:"description=Paper format (Letter Legal A4 etc)"`
}

type PDFOutput

type PDFOutput struct {
	Data string `json:"data"`
}

type PressInput

type PressInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	Key       string `json:"key" jsonschema:"description=Key to press (e.g. Enter Tab ArrowDown),required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type PressOutput

type PressOutput struct {
	Message string `json:"message"`
}

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

Recorder captures MCP tool calls and converts them to a script.

func NewRecorder

func NewRecorder() *Recorder

NewRecorder creates a new Recorder.

func (*Recorder) AddStep

func (r *Recorder) AddStep(step script.Step)

AddStep records a step if recording is active.

func (*Recorder) Clear

func (r *Recorder) Clear()

Clear removes all recorded steps.

func (*Recorder) Export

func (r *Recorder) Export() *script.Script

Export returns the recorded session as a Script.

func (*Recorder) ExportJSON

func (r *Recorder) ExportJSON() ([]byte, error)

ExportJSON returns the recorded session as JSON.

func (*Recorder) IsRecording

func (r *Recorder) IsRecording() bool

IsRecording returns whether recording is active.

func (*Recorder) RecordAccessibilityCheck

func (r *Recorder) RecordAccessibilityCheck(standard, failOn string)

RecordAccessibilityCheck records an assertAccessibility action.

func (*Recorder) RecordAssertElement

func (r *Recorder) RecordAssertElement(selector string)

RecordAssertElement records an assertElement action.

func (*Recorder) RecordAssertText

func (r *Recorder) RecordAssertText(selector, expected string)

RecordAssertText records an assertText action.

func (*Recorder) RecordAssertTitle

func (r *Recorder) RecordAssertTitle(expected string)

RecordAssertTitle records an assertTitle action.

func (*Recorder) RecordAssertURL

func (r *Recorder) RecordAssertURL(expected string)

RecordAssertURL records an assertUrl action.

func (*Recorder) RecordAssertVisible

func (r *Recorder) RecordAssertVisible(selector string)

RecordAssertVisible records an assertVisible action.

func (*Recorder) RecordBack

func (r *Recorder) RecordBack()

RecordBack records a back action.

func (*Recorder) RecordCheck

func (r *Recorder) RecordCheck(selector string)

RecordCheck records a check action.

func (*Recorder) RecordClear

func (r *Recorder) RecordClear(selector string)

RecordClear records a clear action.

func (*Recorder) RecordClick

func (r *Recorder) RecordClick(selector string)

RecordClick records a click action.

func (*Recorder) RecordDblClick

func (r *Recorder) RecordDblClick(selector string)

RecordDblClick records a double-click action.

func (*Recorder) RecordDragTo

func (r *Recorder) RecordDragTo(selector, target string)

RecordDragTo records a dragTo action.

func (*Recorder) RecordEval

func (r *Recorder) RecordEval(js string)

RecordEval records an eval action.

func (*Recorder) RecordFill

func (r *Recorder) RecordFill(selector, value string)

RecordFill records a fill action.

func (*Recorder) RecordFocus

func (r *Recorder) RecordFocus(selector string)

RecordFocus records a focus action.

func (*Recorder) RecordForward

func (r *Recorder) RecordForward()

RecordForward records a forward action.

func (*Recorder) RecordHover

func (r *Recorder) RecordHover(selector string)

RecordHover records a hover action.

func (*Recorder) RecordKeyboardPress

func (r *Recorder) RecordKeyboardPress(key string)

RecordKeyboardPress records a keyboardPress action.

func (*Recorder) RecordKeyboardType

func (r *Recorder) RecordKeyboardType(text string)

RecordKeyboardType records a keyboardType action.

func (*Recorder) RecordMouseClick

func (r *Recorder) RecordMouseClick(x, y float64)

RecordMouseClick records a mouseClick action.

func (*Recorder) RecordMouseMove

func (r *Recorder) RecordMouseMove(x, y float64)

RecordMouseMove records a mouseMove action.

func (*Recorder) RecordNavigate

func (r *Recorder) RecordNavigate(url string)

RecordNavigate records a navigation action.

func (*Recorder) RecordPress

func (r *Recorder) RecordPress(selector, key string)

RecordPress records a press action.

func (*Recorder) RecordReload

func (r *Recorder) RecordReload()

RecordReload records a reload action.

func (*Recorder) RecordScreenshot

func (r *Recorder) RecordScreenshot(file string, fullPage bool)

RecordScreenshot records a screenshot action.

func (*Recorder) RecordScrollIntoView

func (r *Recorder) RecordScrollIntoView(selector string)

RecordScrollIntoView records a scroll action.

func (*Recorder) RecordSelect

func (r *Recorder) RecordSelect(selector, value string)

RecordSelect records a select action.

func (*Recorder) RecordSetFiles

func (r *Recorder) RecordSetFiles(selector string, files []string)

RecordSetFiles records a setFiles action.

func (*Recorder) RecordSetViewport

func (r *Recorder) RecordSetViewport(width, height int)

RecordSetViewport records a setViewport action.

func (*Recorder) RecordTap

func (r *Recorder) RecordTap(selector string)

RecordTap records a tap action.

func (*Recorder) RecordType

func (r *Recorder) RecordType(selector, text string)

RecordType records a type action.

func (*Recorder) RecordUncheck

func (r *Recorder) RecordUncheck(selector string)

RecordUncheck records an uncheck action.

func (*Recorder) RecordWait

func (r *Recorder) RecordWait(duration string)

RecordWait records a wait action.

func (*Recorder) RecordWaitForLoad

func (r *Recorder) RecordWaitForLoad(state string)

RecordWaitForLoad records a waitForLoad action.

func (*Recorder) RecordWaitForSelector

func (r *Recorder) RecordWaitForSelector(selector, state string)

RecordWaitForSelector records a waitForSelector action.

func (*Recorder) RecordWaitForURL

func (r *Recorder) RecordWaitForURL(pattern string)

RecordWaitForURL records a waitForUrl action.

func (*Recorder) Start

func (r *Recorder) Start(metadata RecorderMetadata)

Start begins recording actions.

func (*Recorder) StepCount

func (r *Recorder) StepCount() int

StepCount returns the number of recorded steps.

func (*Recorder) Steps

func (r *Recorder) Steps() []script.Step

Steps returns a copy of the recorded steps.

func (*Recorder) Stop

func (r *Recorder) Stop()

Stop ends recording.

type RecorderMetadata

type RecorderMetadata struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	BaseURL     string `json:"baseUrl,omitempty"`
}

RecorderMetadata contains metadata about the recording session.

type RecordingStatusInput

type RecordingStatusInput struct{}

type RecordingStatusOutput

type RecordingStatusOutput struct {
	Recording bool `json:"recording"`
	StepCount int  `json:"stepCount"`
}

type ReloadInput

type ReloadInput struct{}

type ReloadOutput

type ReloadOutput struct {
	Message string `json:"message"`
}

type ResetSessionInput

type ResetSessionInput struct{}

type ResetSessionOutput

type ResetSessionOutput struct {
	Message string `json:"message"`
}

type ScreenshotInput

type ScreenshotInput struct {
	Format string `json:"format" jsonschema:"description=Output format: base64 (default) or file,enum=base64,enum=file"`
	Path   string `json:"path" jsonschema:"description=File path (required if format is file)"`
}

type ScreenshotOutput

type ScreenshotOutput struct {
	Format string `json:"format"`
	Data   string `json:"data,omitempty"`
	Path   string `json:"path,omitempty"`
}

type ScrollIntoViewInput

type ScrollIntoViewInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type ScrollIntoViewOutput

type ScrollIntoViewOutput struct {
	Message string `json:"message"`
}

type SelectOptionInput

type SelectOptionInput struct {
	Selector  string   `json:"selector" jsonschema:"description=CSS selector for the select element,required"`
	Values    []string `json:"values" jsonschema:"description=Option values to select"`
	Labels    []string `json:"labels" jsonschema:"description=Option labels to select"`
	Indexes   []int    `json:"indexes" jsonschema:"description=Option indexes to select (0-based)"`
	TimeoutMS int      `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type SelectOptionOutput

type SelectOptionOutput struct {
	Message string `json:"message"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the Vibium MCP server.

func NewServer

func NewServer(config Config) *Server

NewServer creates a new MCP server.

func (*Server) Close

func (s *Server) Close(ctx context.Context) error

Close closes the server and browser session.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the MCP server.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session manages a browser session and collects test results.

func NewSession

func NewSession(config SessionConfig) *Session

NewSession creates a new Session.

func (*Session) CaptureContext

func (s *Session) CaptureContext(ctx context.Context) *report.StepContext

CaptureContext captures the current page context.

func (*Session) CaptureScreenshot

func (s *Session) CaptureScreenshot(ctx context.Context) *report.ScreenshotRef

CaptureScreenshot captures a screenshot and returns a ScreenshotRef.

func (*Session) Close

func (s *Session) Close(ctx context.Context) error

Close closes the browser session.

func (*Session) FindSimilarSelectors

func (s *Session) FindSimilarSelectors(ctx context.Context, selector string) []string

FindSimilarSelectors attempts to find similar selectors to the given one.

func (*Session) GetTestResult

func (s *Session) GetTestResult() *report.TestResult

GetTestResult returns the current test result.

func (*Session) LaunchIfNeeded

func (s *Session) LaunchIfNeeded(ctx context.Context) error

LaunchIfNeeded launches the browser if not already running.

func (*Session) NextStepID

func (s *Session) NextStepID(action string) string

NextStepID returns the next step ID.

func (*Session) RecordStep

func (s *Session) RecordStep(result report.StepResult)

RecordStep records a step result.

func (*Session) Recorder

func (s *Session) Recorder() *Recorder

Recorder returns the session's recorder.

func (*Session) Reset

func (s *Session) Reset()

Reset clears the session results.

func (*Session) SetTarget

func (s *Session) SetTarget(target string)

SetTarget sets the test target description.

func (*Session) Vibe

func (s *Session) Vibe(ctx context.Context) (*vibium.Vibe, error)

Vibe returns the browser controller, launching if needed.

type SessionConfig

type SessionConfig struct {
	Headless       bool
	DefaultTimeout time.Duration
	Project        string
	Target         string
}

SessionConfig holds session configuration.

type SetContentInput

type SetContentInput struct {
	HTML string `json:"html" jsonschema:"description=HTML content to set,required"`
}

type SetContentOutput

type SetContentOutput struct {
	Message string `json:"message"`
}

type SetCookieInput

type SetCookieInput struct {
	Name     string  `json:"name"`
	Value    string  `json:"value"`
	URL      string  `json:"url,omitempty"`
	Domain   string  `json:"domain,omitempty"`
	Path     string  `json:"path,omitempty"`
	Expires  float64 `json:"expires,omitempty"`
	HTTPOnly bool    `json:"httpOnly,omitempty"`
	Secure   bool    `json:"secure,omitempty"`
	SameSite string  `json:"sameSite,omitempty"`
}

type SetCookiesInput

type SetCookiesInput struct {
	Cookies []SetCookieInput `json:"cookies" jsonschema:"description=Cookies to set,required"`
}

type SetCookiesOutput

type SetCookiesOutput struct {
	Message string `json:"message"`
}

type SetFilesInput

type SetFilesInput struct {
	Selector  string   `json:"selector" jsonschema:"description=CSS selector for the file input,required"`
	Files     []string `json:"files" jsonschema:"description=File paths to set,required"`
	TimeoutMS int      `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type SetFilesOutput

type SetFilesOutput struct {
	Message string `json:"message"`
}

type SetGeolocationInput

type SetGeolocationInput struct {
	Latitude  float64 `json:"latitude" jsonschema:"description=Latitude,required"`
	Longitude float64 `json:"longitude" jsonschema:"description=Longitude,required"`
	Accuracy  float64 `json:"accuracy" jsonschema:"description=Accuracy in meters"`
}

type SetGeolocationOutput

type SetGeolocationOutput struct {
	Message string `json:"message"`
}

type SetTargetInput

type SetTargetInput struct {
	Target string `json:"target" jsonschema:"description=Test target description,required"`
}

type SetTargetOutput

type SetTargetOutput struct {
	Message string `json:"message"`
}

type SetViewportInput

type SetViewportInput struct {
	Width  int `json:"width" jsonschema:"description=Viewport width,required"`
	Height int `json:"height" jsonschema:"description=Viewport height,required"`
}

type SetViewportOutput

type SetViewportOutput struct {
	Message string `json:"message"`
}

type StartRecordingInput

type StartRecordingInput struct {
	Name        string `json:"name,omitempty" jsonschema:"description=Name for the recorded script"`
	Description string `json:"description,omitempty" jsonschema:"description=Description of what the script tests"`
	BaseURL     string `json:"baseUrl,omitempty" jsonschema:"description=Base URL for relative URLs in the script"`
}

type StartRecordingOutput

type StartRecordingOutput struct {
	Message string `json:"message"`
}

type StopRecordingInput

type StopRecordingInput struct{}

type StopRecordingOutput

type StopRecordingOutput struct {
	Message   string `json:"message"`
	StepCount int    `json:"stepCount"`
}

type TapInput

type TapInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type TapOutput

type TapOutput struct {
	Message string `json:"message"`
}

type TouchSwipeInput

type TouchSwipeInput struct {
	StartX float64 `json:"start_x" jsonschema:"description=Starting X coordinate,required"`
	StartY float64 `json:"start_y" jsonschema:"description=Starting Y coordinate,required"`
	EndX   float64 `json:"end_x" jsonschema:"description=Ending X coordinate,required"`
	EndY   float64 `json:"end_y" jsonschema:"description=Ending Y coordinate,required"`
}

type TouchSwipeOutput

type TouchSwipeOutput struct {
	Message string `json:"message"`
}

type TouchTapInput

type TouchTapInput struct {
	X float64 `json:"x" jsonschema:"description=X coordinate,required"`
	Y float64 `json:"y" jsonschema:"description=Y coordinate,required"`
}

type TouchTapOutput

type TouchTapOutput struct {
	Message string `json:"message"`
}

type TypeInput

type TypeInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the input element,required"`
	Text      string `json:"text" jsonschema:"description=Text to type,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type TypeOutput

type TypeOutput struct {
	Message string `json:"message"`
}

type UncheckInput

type UncheckInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the checkbox,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 5000)"`
}

type UncheckOutput

type UncheckOutput struct {
	Message string `json:"message"`
}

type WaitForFunctionInput

type WaitForFunctionInput struct {
	Function  string `json:"function" jsonschema:"description=JavaScript function that returns truthy value,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 30000)"`
}

type WaitForFunctionOutput

type WaitForFunctionOutput struct {
	Message string `json:"message"`
}

type WaitForLoadInput

type WaitForLoadInput struct {
	State     string `` /* 141-byte string literal not displayed */
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 30000)"`
}

type WaitForLoadOutput

type WaitForLoadOutput struct {
	Message string `json:"message"`
}

type WaitForURLInput

type WaitForURLInput struct {
	Pattern   string `json:"pattern" jsonschema:"description=URL pattern to wait for,required"`
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 30000)"`
}

type WaitForURLOutput

type WaitForURLOutput struct {
	Message string `json:"message"`
}

type WaitUntilInput

type WaitUntilInput struct {
	Selector  string `json:"selector" jsonschema:"description=CSS selector for the element,required"`
	State     string `` /* 151-byte string literal not displayed */
	TimeoutMS int    `json:"timeout_ms" jsonschema:"description=Timeout in milliseconds (default: 30000)"`
}

type WaitUntilOutput

type WaitUntilOutput struct {
	Message string `json:"message"`
}

Directories

Path Synopsis
Package report provides test result tracking and report generation.
Package report provides test result tracking and report generation.

Jump to

Keyboard shortcuts

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