Documentation
¶
Overview ¶
Package tools exposes agnt's functionality as MCP tools for AI agents. Each tool is registered with an MCP server via RegisterDaemonTools().
Tools communicate with the daemon over IPC (socket/pipe) using the daemon.Client. DaemonTools manages the connection lifecycle, session attachment, and auto-start configuration.
Handler functions are organized by domain in daemon_*.go files. Converter and formatting functions live in converters.go.
Index ¶
- Constants
- Variables
- func ChannelServerOptions(opts *mcp.ServerOptions, cfg *config.ChannelConfig) *mcp.ServerOptions
- func DispatchResult[D, L, R any](b DualBackend[D, L], daemonFn func(*D) (R, error), ...) (R, error)
- func GetAPIOverview() string
- func GetFunctionDescription(name string) (string, bool)
- func ListFunctionNames() []string
- func RegisterAutomationTool(server *mcp.Server, dt *DaemonTools)
- func RegisterBrowserTool(server *mcp.Server, dt *DaemonTools)
- func RegisterChannelReplyTool(server *mcp.Server, dt *DaemonTools)
- func RegisterDaemonManagementTool(server *mcp.Server, dt *DaemonTools)
- func RegisterDaemonTools(server *mcp.Server, dt *DaemonTools)
- func RegisterGetErrorsTool(server *mcp.Server, dt *DaemonTools, pm *proxy.ProxyManager)
- func RegisterProcessTools(server *mcp.Server, pm *process.ProcessManager)
- func RegisterProjectTools(server *mcp.Server)
- func RegisterProxyTools(server *mcp.Server, pm *proxy.ProxyManager)
- func RegisterResponsiveAuditTool(server *mcp.Server, dt *DaemonTools, pm *proxy.ProxyManager)
- func RegisterSessionTool(server *mcp.Server, dt *DaemonTools)
- func RegisterSnapshotTools(server *mcp.Server, manager *snapshot.Manager)
- func RegisterStoreTool(server *mcp.Server, dt *DaemonTools)
- func RegisterTunnelTool(server *mcp.Server, dt *DaemonTools)
- func ScanForHints(js string) []string
- type APICategory
- type APIFunction
- type APISearchMatch
- type APISearchResult
- type AutomationEntry
- type AutomationInput
- type AutomationOutput
- type BrowserEntry
- type BrowserInput
- type BrowserOutput
- type ChannelReplyInput
- type ChannelReplyOutput
- type ChannelSessionHandle
- type ChannelSink
- type ChaosConfigInput
- type ChaosRuleInput
- type ChaosRuleOutput
- type ChaosStatsOutput
- type CompactError
- type CompactHTTPRequest
- type CompactInteraction
- type CompactLogEntry
- type CompactMutation
- type CompactPerformance
- type CurrentPageInput
- type CurrentPageOutput
- type DaemonInput
- type DaemonOutput
- type DaemonTools
- func (dt *DaemonTools) AlertSink() daemon.MCPAlertSink
- func (dt *DaemonTools) ChannelSessionCode() string
- func (dt *DaemonTools) Close() error
- func (dt *DaemonTools) RegisterChannelSession(ctx context.Context, cfg *config.ChannelConfig, projectPath string) *ChannelSessionHandle
- func (dt *DaemonTools) RunAutostart(projectDir string) (map[string]interface{}, error)
- func (dt *DaemonTools) SessionCode() string
- func (dt *DaemonTools) SetAlertSink(sink daemon.MCPAlertSink)
- func (dt *DaemonTools) SetNoAutoAttach(noAttach bool)
- func (dt *DaemonTools) SetSessionCode(code string)
- func (dt *DaemonTools) StartChannelSink(server *mcp.Server, cfg *config.ChannelConfig, projectPath string) context.CancelFunc
- type DetectInput
- type DetectOutput
- type DualBackend
- type ErrorSummary
- type GetErrorsInput
- type GetErrorsOutput
- type LogEntryOutput
- type LogStatsOutput
- type NotifyFunc
- type PageSessionOutput
- type PageSummaryOutput
- type Pagination
- type ProcEntry
- type ProcInput
- type ProcOutput
- type ProcessInfo
- type ProcessRole
- type ProxyEntry
- type ProxyInfo
- type ProxyInput
- type ProxyLogInput
- type ProxyLogOutput
- type ProxyLogSummary
- type ProxyOutput
- type ResponsiveAuditInput
- type ResponsiveAuditOutput
- type RunInput
- type RunMode
- type RunOutput
- type SessionEntry
- type SessionInput
- type SessionOutput
- type SnapshotInput
- type SnapshotOutput
- type StoreEntryOutput
- type StoreInput
- type StoreOutput
- type TaskEntry
- type TimeRange
- type TunnelEntry
- type TunnelInput
- type TunnelOutput
- type TunnelStatus
- type ViewportInput
- type WatchInput
- type WatchOutput
Constants ¶
const ChannelCapabilityName = "claude/channel"
ChannelCapabilityName is the experimental capability key used to declare support for the claude/channel push-based event protocol.
const ChannelInstructions = `` /* 683-byte string literal not displayed */
ChannelInstructions is appended to the standard MCP Instructions when channel mode is active. It tells the AI agent how to interpret incoming channel events.
const (
// ChannelNotificationMethod is the MCP notification method for channel events.
ChannelNotificationMethod = "notifications/claude/channel"
)
const ProxyToolDescription = `` /* 1536-byte string literal not displayed */
ProxyToolDescription is the shared description for the proxy MCP tool. Both daemon_tools.go and proxy_tools.go reference this constant so the description stays in sync across both registration paths.
Variables ¶
var DevToolAPIDocs = devToolAPIDocs{ Categories: []APICategory{ {Name: "logging", Description: "Send custom log messages to the proxy server"}, {Name: "screenshot", Description: "Capture screenshots of the page or elements"}, {Name: "inspection", Description: "Get detailed information about DOM elements"}, {Name: "tree", Description: "Walk and navigate the DOM tree"}, {Name: "visual", Description: "Check visibility and viewport state"}, {Name: "layout", Description: "Diagnose layout issues (overflow, stacking, offscreen)"}, {Name: "overlay", Description: "Highlight elements visually on the page"}, {Name: "interactive", Description: "Interactive element selection and measurement"}, {Name: "capture", Description: "Capture page state, styles, and network info"}, {Name: "accessibility", Description: "Accessibility auditing and information"}, {Name: "audit", Description: "Page quality audits (DOM complexity, CSS, security)"}, {Name: "interactions", Description: "Track and query user interactions (clicks, keyboard, scroll)"}, {Name: "mutations", Description: "Track and query DOM mutations (added, removed, modified)"}, {Name: "indicator", Description: "Control the floating indicator bug"}, {Name: "sketch", Description: "Wireframing and annotation mode"}, {Name: "content", Description: "Content extraction, navigation, sitemaps, and markdown conversion"}, {Name: "connection", Description: "WebSocket connection status"}, }, Functions: DevToolAPIFunctions, }
DevToolAPIDocs contains the full API documentation. Functions is sourced from the generated DevToolAPIFunctions; Categories is authored here.
var DevToolAPIFunctions = []APIFunction{ { Name: "auditAccessibility", Category: "accessibility", Description: "Run accessibility audit on the page", Signature: "auditAccessibility()", Parameters: []string{}, Returns: "{issues: [...], summary: {critical, serious, moderate, minor}}", Example: "__devtool.auditAccessibility()", }, { Name: "getA11yInfo", Category: "accessibility", Description: "Get accessibility information for an element", Signature: "getA11yInfo(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{role, name, description, state, properties}", Example: "__devtool.getA11yInfo(\"#submit-button\")", }, { Name: "getContrast", Category: "accessibility", Description: "Calculate color contrast ratio for text", Signature: "getContrast(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{ratio, foreground, background, passesAA, passesAAA}", Example: "__devtool.getContrast(\".body-text\")", }, { Name: "getScreenReaderText", Category: "accessibility", Description: "Get text as a screen reader would announce it", Signature: "getScreenReaderText(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "string", Example: "__devtool.getScreenReaderText(\"#nav-menu\")", }, { Name: "getTabOrder", Category: "accessibility", Description: "Get focusable elements in tab order", Signature: "getTabOrder()", Parameters: []string{}, Returns: "[{element, tabIndex, natural}, ...]", Example: "__devtool.getTabOrder()", }, { Name: "auditCSS", Category: "audit", Description: "Analyze CSS usage and potential issues", Signature: "auditCSS()", Parameters: []string{}, Returns: "{unusedRules, duplicates, specificity, importantCount}", Example: "__devtool.auditCSS()", }, { Name: "auditDOMComplexity", Category: "audit", Description: "Analyze DOM complexity and depth", Signature: "auditDOMComplexity()", Parameters: []string{}, Returns: "{elementCount, maxDepth, avgDepth, deepElements, widest}", Example: "__devtool.auditDOMComplexity()", }, { Name: "auditPageQuality", Category: "audit", Description: "Comprehensive page quality audit", Signature: "auditPageQuality()", Parameters: []string{}, Returns: "{dom, css, accessibility, security, performance}", Example: "__devtool.auditPageQuality()", }, { Name: "auditSecurity", Category: "audit", Description: "Check for common security issues", Signature: "auditSecurity()", Parameters: []string{}, Returns: "{issues: [...], summary}", Example: "__devtool.auditSecurity()", }, { Name: "captureDOM", Category: "capture", Description: "Capture serialized DOM snapshot", Signature: "captureDOM(selector?)", Parameters: []string{ "selector: string - Root element selector (default: body)", }, Returns: "{html, text, elementCount, timestamp}", Example: "__devtool.captureDOM(\"#main-content\")", }, { Name: "captureNetwork", Category: "capture", Description: "Get performance timing and resource information", Signature: "captureNetwork()", Parameters: []string{}, Returns: "{timing, resources: [...], paintTiming}", Example: "__devtool.captureNetwork()", }, { Name: "captureState", Category: "capture", Description: "Capture comprehensive page state", Signature: "captureState()", Parameters: []string{}, Returns: "{url, title, viewport, scroll, forms, localStorage, sessionStorage}", Example: "__devtool.captureState()", }, { Name: "captureStyles", Category: "capture", Description: "Capture all stylesheets and computed styles", Signature: "captureStyles()", Parameters: []string{}, Returns: "{stylesheets: [...], inlineStyles: [...]}", Example: "__devtool.captureStyles()", }, { Name: "getStatus", Category: "connection", Description: "Get detailed WebSocket connection status", Signature: "getStatus()", Parameters: []string{}, Returns: "string - connecting, connected, closing, closed, not_initialized, unknown", Example: "console.log(__devtool.getStatus())", }, { Name: "isConnected", Category: "connection", Description: "Check if WebSocket is connected to proxy server", Signature: "isConnected()", Parameters: []string{}, Returns: "boolean", Example: "if (__devtool.isConnected()) { ... }", }, { Name: "content.buildSitemap", Category: "content", Description: "Build sitemap structure from internal links on the page", Signature: "content.buildSitemap(options?)", Parameters: []string{ "options.maxDepth: number - Maximum URL depth to include (default: 5)", }, Returns: "{url, baseUrl, pages{}, tree{}, stats}", Example: "__devtool.content.buildSitemap()", }, { Name: "content.extractContent", Category: "content", Description: "Extract page content as markdown", Signature: "content.extractContent(options?)", Parameters: []string{ "options.selector: string - Selector for main content (auto-detected if not provided)", "options.includeImages: boolean - Include image references (default: true)", "options.includeLinks: boolean - Include link URLs (default: true)", "options.maxLength: number - Maximum content length (default: 50000)", }, Returns: "{url, title, selector, markdown, meta, headings[], wordCount, truncated}", Example: "__devtool.content.extractContent({selector: \"article\"})", }, { Name: "content.extractHeadings", Category: "content", Description: "Extract heading hierarchy for page outline", Signature: "content.extractHeadings(scope?)", Parameters: []string{ "scope: Element - Optional scope element (default: document)", }, Returns: "[{level, text, id}]", Example: "__devtool.content.extractHeadings()", }, { Name: "content.extractLinks", Category: "content", Description: "Extract all links from the page with context (navigation, footer, etc.)", Signature: "content.extractLinks(options?)", Parameters: []string{ "options.internal: boolean - Only internal links", "options.external: boolean - Only external links", "options.includeAnchors: boolean - Include anchor-only links", "options.selector: string - Limit to links within selector", }, Returns: "{url, internal[], external[], anchors[], mailto[], tel[], other[], stats}", Example: "__devtool.content.extractLinks({internal: true})", }, { Name: "content.extractNavigation", Category: "content", Description: "Extract navigation structure from the page (nav elements, header, footer, breadcrumbs)", Signature: "content.extractNavigation()", Parameters: []string{}, Returns: "{url, navElements[], header, footer, breadcrumbs, sidebar}", Example: "__devtool.content.extractNavigation()", }, { Name: "content.extractStructuredData", Category: "content", Description: "Extract structured data (JSON-LD, Open Graph, Twitter Cards)", Signature: "content.extractStructuredData()", Parameters: []string{}, Returns: "{url, jsonLd[], openGraph{}, twitter{}, microdata[]}", Example: "__devtool.content.extractStructuredData()", }, { Name: "indicator.destroy", Category: "indicator", Description: "Remove the floating indicator completely", Signature: "indicator.destroy()", Parameters: []string{}, Returns: "void", Example: "__devtool.indicator.destroy()", }, { Name: "indicator.hide", Category: "indicator", Description: "Hide the floating indicator", Signature: "indicator.hide()", Parameters: []string{}, Returns: "void", Example: "__devtool.indicator.hide()", }, { Name: "indicator.show", Category: "indicator", Description: "Show the floating indicator", Signature: "indicator.show()", Parameters: []string{}, Returns: "void", Example: "__devtool.indicator.show()", }, { Name: "indicator.toggle", Category: "indicator", Description: "Toggle the floating indicator visibility", Signature: "indicator.toggle()", Parameters: []string{}, Returns: "void", Example: "__devtool.indicator.toggle()", }, { Name: "indicator.togglePanel", Category: "indicator", Description: "Toggle the indicator's expanded panel", Signature: "indicator.togglePanel()", Parameters: []string{}, Returns: "void", Example: "__devtool.indicator.togglePanel()", }, { Name: "getBox", Category: "inspection", Description: "Get box model dimensions (content, padding, border, margin)", Signature: "getBox(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{content, padding, border, margin} with {top, right, bottom, left}", Example: "__devtool.getBox(\".container\")", }, { Name: "getComputed", Category: "inspection", Description: "Get computed CSS styles for an element", Signature: "getComputed(selector, properties?)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", "[properties=common: string[] - properties] - Specific properties to get", }, Returns: "{property: value, ...}", Example: "__devtool.getComputed(\"#header\", [\"display\", \"position\", \"z-index\"])", }, { Name: "getContainer", Category: "inspection", Description: "Get containing block and scroll container", Signature: "getContainer(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{containingBlock, scrollContainer, offsetParent}", Example: "__devtool.getContainer(\".absolute-element\")", }, { Name: "getElementInfo", Category: "inspection", Description: "Get comprehensive information about an element", Signature: "getElementInfo(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{tag, id, classes, attributes, text, html, dimensions, position}", Example: "__devtool.getElementInfo(\"#submit-btn\")", }, { Name: "getLayout", Category: "inspection", Description: "Get layout information (display, position, flexbox/grid)", Signature: "getLayout(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{display, position, float, flexbox?, grid?}", Example: "__devtool.getLayout(\".flex-container\")", }, { Name: "getOverflow", Category: "inspection", Description: "Get overflow and scroll information", Signature: "getOverflow(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{overflow, overflowX, overflowY, scrollWidth, scrollHeight, isScrollable}", Example: "__devtool.getOverflow(\".scrollable-panel\")", }, { Name: "getPosition", Category: "inspection", Description: "Get element position (bounding rect)", Signature: "getPosition(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{top, right, bottom, left, width, height, x, y}", Example: "__devtool.getPosition(\".modal\")", }, { Name: "getStacking", Category: "inspection", Description: "Get stacking context information (z-index, creates context)", Signature: "getStacking(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{zIndex, createsContext, reason?, parentContext}", Example: "__devtool.getStacking(\".modal-overlay\")", }, { Name: "getTransform", Category: "inspection", Description: "Get CSS transform information", Signature: "getTransform(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{transform, transformOrigin, matrix}", Example: "__devtool.getTransform(\".rotated-element\")", }, { Name: "inspect", Category: "inspection", Description: "Get comprehensive inspection of an element (combines multiple inspection calls)", Signature: "inspect(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{info, position, box, layout, stacking, container, visibility, viewport}", Example: "__devtool.inspect(\"#main-form\")", }, { Name: "interactions.clear", Category: "interactions", Description: "Clear interaction history", Signature: "interactions.clear()", Parameters: []string{}, Returns: "void", Example: "__devtool.interactions.clear()", }, { Name: "interactions.getClicksOn", Category: "interactions", Description: "Get all clicks on elements matching selector", Signature: "interactions.getClicksOn(selector)", Parameters: []string{ "selector: string - Selector pattern to match in target", }, Returns: "[{event_type, target, position, timestamp}, ...]", Example: "__devtool.interactions.getClicksOn(\"button\")", }, { Name: "interactions.getHistory", Category: "interactions", Description: "Get recent interaction history", Signature: "interactions.getHistory(count?)", Parameters: []string{ "count: number - Number of interactions to return (default: 50)", }, Returns: "[{event_type, target, position?, timestamp}, ...]", Example: "__devtool.interactions.getHistory(10)", }, { Name: "interactions.getLastClick", Category: "interactions", Description: "Get the most recent click event", Signature: "interactions.getLastClick()", Parameters: []string{}, Returns: "{event_type, target, position, timestamp}|null", Example: "__devtool.interactions.getLastClick()", }, { Name: "interactions.getLastClickContext", Category: "interactions", Description: "Get last click with surrounding mouse trail", Signature: "interactions.getLastClickContext(trailMs?)", Parameters: []string{ "trailMs: number - Trail window in ms (default: 2000)", }, Returns: "{click, mouseTrail}|null", Example: "__devtool.interactions.getLastClickContext()", }, { Name: "interactions.getMouseTrail", Category: "interactions", Description: "Get mouse movement samples around a timestamp", Signature: "interactions.getMouseTrail(timestamp, windowMs?)", Parameters: []string{ "timestamp: number - Center timestamp", "windowMs: number - Time window in ms (default: 5000)", }, Returns: "[{position, wall_time, interaction_time}, ...]", Example: "__devtool.interactions.getMouseTrail(Date.now() - 1000)", }, { Name: "ask", Category: "interactive", Description: "Display a prompt dialog and wait for user input", Signature: "ask(question, options?)", Parameters: []string{ "question: string - Question to display", "}: {choices?, default? - options - Dialog options", }, Returns: "Promise<string> - User's answer", Example: "const answer = await __devtool.ask(\"What color?\", {choices: [\"red\", \"blue\"]})", }, { Name: "measureBetween", Category: "interactive", Description: "Measure distance between two elements", Signature: "measureBetween(selector1, selector2)", Parameters: []string{ "selector1: string|Element - First element", "selector2: string|Element - Second element", }, Returns: "{horizontal, vertical, diagonal}", Example: "__devtool.measureBetween(\".header\", \".footer\")", }, { Name: "selectElement", Category: "interactive", Description: "Enter interactive mode to select an element by clicking", Signature: "selectElement()", Parameters: []string{}, Returns: "Promise<Element> - The selected element", Example: "const el = await __devtool.selectElement()", }, { Name: "waitForElement", Category: "interactive", Description: "Wait for an element to appear in the DOM", Signature: "waitForElement(selector, timeout?)", Parameters: []string{ "selector: string - CSS selector", "timeout: number - Max wait time in ms (default: 5000)", }, Returns: "Promise<Element>", Example: "const modal = await __devtool.waitForElement(\".modal-open\")", }, { Name: "diagnoseLayout", Category: "layout", Description: "Run comprehensive layout diagnostics", Signature: "diagnoseLayout(selector?)", Parameters: []string{ "selector: string - Optional element to focus analysis on", }, Returns: "{overflows, stackingContexts, offscreen, element?}", Example: "__devtool.diagnoseLayout()", }, { Name: "findOffscreen", Category: "layout", Description: "Find elements positioned outside the viewport", Signature: "findOffscreen()", Parameters: []string{}, Returns: "[{element, position, distance}, ...]", Example: "__devtool.findOffscreen()", }, { Name: "findOverflows", Category: "layout", Description: "Find elements causing horizontal overflow", Signature: "findOverflows()", Parameters: []string{}, Returns: "[{element, overflow, width, parentWidth}, ...]", Example: "__devtool.findOverflows()", }, { Name: "findStackingContexts", Category: "layout", Description: "Find all stacking contexts in the document", Signature: "findStackingContexts()", Parameters: []string{}, Returns: "[{element, zIndex, reason}, ...]", Example: "__devtool.findStackingContexts()", }, { Name: "debug", Category: "logging", Description: "Send a debug-level log message", Signature: "debug(message, data?)", Parameters: []string{ "message: string - The log message", "data: object - Optional additional data", }, Returns: "void", Example: "__devtool.debug(\"Component rendered\", {props: {id: 1}})", }, { Name: "error", Category: "logging", Description: "Send an error-level log message", Signature: "error(message, data?)", Parameters: []string{ "message: string - The log message", "data: object - Optional additional data", }, Returns: "void", Example: "__devtool.error(\"Failed to load data\", {status: 500})", }, { Name: "info", Category: "logging", Description: "Send an info-level log message", Signature: "info(message, data?)", Parameters: []string{ "message: string - The log message", "data: object - Optional additional data", }, Returns: "void", Example: "__devtool.info(\"Page loaded successfully\")", }, { Name: "log", Category: "logging", Description: "Send a custom log message to the proxy server", Signature: "log(message, level?, data?)", Parameters: []string{ "message: string - The log message", "level: string - Log level: debug, info, warn, error (default: info)", "data: object - Optional additional data", }, Returns: "void", Example: "__devtool.log(\"User clicked button\", \"info\", {buttonId: \"submit\"})", }, { Name: "warn", Category: "logging", Description: "Send a warning-level log message", Signature: "warn(message, data?)", Parameters: []string{ "message: string - The log message", "data: object - Optional additional data", }, Returns: "void", Example: "__devtool.warn(\"Deprecated API used\", {api: \"oldMethod\"})", }, { Name: "mutations.clear", Category: "mutations", Description: "Clear mutation history", Signature: "mutations.clear()", Parameters: []string{}, Returns: "void", Example: "__devtool.mutations.clear()", }, { Name: "mutations.getAdded", Category: "mutations", Description: "Get elements added to DOM since timestamp", Signature: "mutations.getAdded(since?)", Parameters: []string{ "since: number - Timestamp filter (default: 0)", }, Returns: "[{mutation_type: 'added', target, added, timestamp}, ...]", Example: "__devtool.mutations.getAdded(Date.now() - 5000)", }, { Name: "mutations.getHistory", Category: "mutations", Description: "Get recent mutation history", Signature: "mutations.getHistory(count?)", Parameters: []string{ "count: number - Number of mutations to return (default: 50)", }, Returns: "[{mutation_type, target, added?, removed?, attribute?, timestamp}, ...]", Example: "__devtool.mutations.getHistory(20)", }, { Name: "mutations.getModified", Category: "mutations", Description: "Get attribute changes since timestamp", Signature: "mutations.getModified(since?)", Parameters: []string{ "since: number - Timestamp filter (default: 0)", }, Returns: "[{mutation_type: 'attributes', target, attribute, timestamp}, ...]", Example: "__devtool.mutations.getModified(Date.now() - 5000)", }, { Name: "mutations.getRemoved", Category: "mutations", Description: "Get elements removed from DOM since timestamp", Signature: "mutations.getRemoved(since?)", Parameters: []string{ "since: number - Timestamp filter (default: 0)", }, Returns: "[{mutation_type: 'removed', target, removed, timestamp}, ...]", Example: "__devtool.mutations.getRemoved(Date.now() - 5000)", }, { Name: "mutations.highlightRecent", Category: "mutations", Description: "Visually highlight recently added elements", Signature: "mutations.highlightRecent(duration?)", Parameters: []string{ "duration: number - How far back to look in ms (default: 5000)", }, Returns: "void", Example: "__devtool.mutations.highlightRecent(3000)", }, { Name: "mutations.pause", Category: "mutations", Description: "Pause mutation tracking", Signature: "mutations.pause()", Parameters: []string{}, Returns: "void", Example: "__devtool.mutations.pause()", }, { Name: "mutations.resume", Category: "mutations", Description: "Resume mutation tracking", Signature: "mutations.resume()", Parameters: []string{}, Returns: "void", Example: "__devtool.mutations.resume()", }, { Name: "clearAllOverlays", Category: "overlay", Description: "Remove all highlight overlays", Signature: "clearAllOverlays()", Parameters: []string{}, Returns: "void", Example: "__devtool.clearAllOverlays()", }, { Name: "highlight", Category: "overlay", Description: "Highlight an element with a colored overlay", Signature: "highlight(selector, options?)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", "}: {color?, label?, duration? - options - Highlight options", }, Returns: "string - Overlay ID for removal", Example: "__devtool.highlight(\"#form\", {color: \"blue\", label: \"Main Form\"})", }, { Name: "removeHighlight", Category: "overlay", Description: "Remove a specific highlight overlay", Signature: "removeHighlight(id)", Parameters: []string{ "id: string - Overlay ID returned by highlight()", }, Returns: "void", Example: "__devtool.removeHighlight(\"overlay-123\")", }, { Name: "screenshot", Category: "screenshot", Description: "Capture a screenshot of the page or a specific element", Signature: "screenshot(name?, selector?)", Parameters: []string{ "name: string - Screenshot name (default: screenshot_<timestamp>)", "selector: string - CSS selector for element to capture (default: body)", }, Returns: "Promise<{name, width, height, selector}>", Example: "await __devtool.screenshot(\"homepage\")\\nawait __devtool.screenshot(\"header\", \"#main-header\")", }, { Name: "sketch.clear", Category: "sketch", Description: "Clear all sketch elements", Signature: "sketch.clear()", Parameters: []string{}, Returns: "void", Example: "__devtool.sketch.clear()", }, { Name: "sketch.close", Category: "sketch", Description: "Close sketch mode", Signature: "sketch.close()", Parameters: []string{}, Returns: "void", Example: "__devtool.sketch.close()", }, { Name: "sketch.fromJSON", Category: "sketch", Description: "Load sketch data from JSON", Signature: "sketch.fromJSON(data)", Parameters: []string{ "data: object - Sketch data from toJSON()", }, Returns: "void", Example: "__devtool.sketch.fromJSON(savedData)", }, { Name: "sketch.open", Category: "sketch", Description: "Open sketch mode for wireframing", Signature: "sketch.open()", Parameters: []string{}, Returns: "void", Example: "__devtool.sketch.open()", }, { Name: "sketch.redo", Category: "sketch", Description: "Redo previously undone action", Signature: "sketch.redo()", Parameters: []string{}, Returns: "void", Example: "__devtool.sketch.redo()", }, { Name: "sketch.save", Category: "sketch", Description: "Save sketch and send to proxy server", Signature: "sketch.save()", Parameters: []string{}, Returns: "void", Example: "__devtool.sketch.save()", }, { Name: "sketch.setTool", Category: "sketch", Description: "Set the active drawing tool", Signature: "sketch.setTool(tool)", Parameters: []string{ "tool: string - Tool name: select, rectangle, ellipse, line, arrow, freedraw, text, note, button, input, image, eraser", }, Returns: "void", Example: "__devtool.sketch.setTool(\"rectangle\")", }, { Name: "sketch.toDataURL", Category: "sketch", Description: "Export sketch as PNG data URL", Signature: "sketch.toDataURL()", Parameters: []string{}, Returns: "string - PNG data URL", Example: "const png = __devtool.sketch.toDataURL()", }, { Name: "sketch.toJSON", Category: "sketch", Description: "Export sketch data as JSON", Signature: "sketch.toJSON()", Parameters: []string{}, Returns: "object - Serialized sketch data", Example: "const data = __devtool.sketch.toJSON()", }, { Name: "sketch.toggle", Category: "sketch", Description: "Toggle sketch mode on/off", Signature: "sketch.toggle()", Parameters: []string{}, Returns: "void", Example: "__devtool.sketch.toggle()", }, { Name: "sketch.undo", Category: "sketch", Description: "Undo last sketch action", Signature: "sketch.undo()", Parameters: []string{}, Returns: "void", Example: "__devtool.sketch.undo()", }, { Name: "findAncestor", Category: "tree", Description: "Find the closest ancestor matching a condition", Signature: "findAncestor(selector, condition)", Parameters: []string{ "selector: string|Element - Starting element", "condition: string|function - CSS selector or predicate function", }, Returns: "Element|null", Example: "__devtool.findAncestor(\".button\", \"[data-modal]\")", }, { Name: "walkChildren", Category: "tree", Description: "Get all child elements with optional filtering", Signature: "walkChildren(selector, options?)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", "}: {maxDepth?, filter? - options - Walk options", }, Returns: "[{element, depth, path}, ...]", Example: "__devtool.walkChildren(\"#container\", {maxDepth: 2})", }, { Name: "walkParents", Category: "tree", Description: "Get all parent elements up to document", Signature: "walkParents(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "[{element, depth}, ...]", Example: "__devtool.walkParents(\".nested-element\")", }, { Name: "checkOverlap", Category: "visual", Description: "Check if two elements overlap", Signature: "checkOverlap(selector1, selector2)", Parameters: []string{ "selector1: string|Element - First element", "selector2: string|Element - Second element", }, Returns: "{overlaps: boolean, intersection?: {x, y, width, height}}", Example: "__devtool.checkOverlap(\".modal\", \".tooltip\")", }, { Name: "isInViewport", Category: "visual", Description: "Check if an element is within the viewport", Signature: "isInViewport(selector, threshold?)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", "threshold: number - Percentage visible required (default: 0)", }, Returns: "{inViewport: boolean, percentVisible: number, position}", Example: "__devtool.isInViewport(\"#footer\", 0.5)", }, { Name: "isVisible", Category: "visual", Description: "Check if an element is visible (not hidden by CSS)", Signature: "isVisible(selector)", Parameters: []string{ "selector: string|Element - CSS selector or DOM element", }, Returns: "{visible: boolean, reasons?: string[]}", Example: "__devtool.isVisible(\".dropdown-menu\")", }, }
DevToolAPIFunctions is the canonical catalog of __devtool.* public functions, extracted from JSDoc blocks in internal/proxy/scripts/*.js.
Functions ¶
func ChannelServerOptions ¶ added in v0.12.44
func ChannelServerOptions(opts *mcp.ServerOptions, cfg *config.ChannelConfig) *mcp.ServerOptions
ChannelServerOptions returns a ServerOptions with channel-specific modifications applied. When channel is disabled (cfg is nil or not enabled), it returns opts unchanged -- preserving byte-for-byte identical default behavior. When channel is enabled, it sets the Experimental capabilities map and appends channel instructions.
func DispatchResult ¶ added in v0.12.45
func DispatchResult[D, L, R any](b DualBackend[D, L], daemonFn func(*D) (R, error), legacyFn func(*L) (R, error)) (R, error)
DispatchResult calls daemonFn if the daemon is non-nil, otherwise calls legacyFn. Use this variant when the dispatch function returns a value alongside an error.
func GetAPIOverview ¶
func GetAPIOverview() string
GetAPIOverview returns a high-level overview of all API categories and functions.
func GetFunctionDescription ¶
GetFunctionDescription returns detailed documentation for a specific function.
func ListFunctionNames ¶
func ListFunctionNames() []string
ListFunctionNames returns all function names for auto-completion.
func RegisterAutomationTool ¶ added in v0.11.1
func RegisterAutomationTool(server *mcp.Server, dt *DaemonTools)
RegisterAutomationTool registers the automation MCP tool with the server.
func RegisterBrowserTool ¶ added in v0.11.1
func RegisterBrowserTool(server *mcp.Server, dt *DaemonTools)
RegisterBrowserTool registers the browser MCP tool with the server.
func RegisterChannelReplyTool ¶ added in v0.12.44
func RegisterChannelReplyTool(server *mcp.Server, dt *DaemonTools)
RegisterChannelReplyTool registers the channel_reply MCP tool. The tool is only registered when channel is enabled and reply-tool is on. dt must be non-nil.
func RegisterDaemonManagementTool ¶
func RegisterDaemonManagementTool(server *mcp.Server, dt *DaemonTools)
RegisterDaemonManagementTool adds the daemon management tool to the server.
func RegisterDaemonTools ¶
func RegisterDaemonTools(server *mcp.Server, dt *DaemonTools)
RegisterDaemonTools adds all MCP tools that communicate with the daemon.
func RegisterGetErrorsTool ¶ added in v0.12.0
func RegisterGetErrorsTool(server *mcp.Server, dt *DaemonTools, pm *proxy.ProxyManager)
RegisterGetErrorsTool registers the get_errors tool. Exactly one of dt or pm must be non-nil.
func RegisterProcessTools ¶
func RegisterProcessTools(server *mcp.Server, pm *process.ProcessManager)
RegisterProcessTools adds process-related MCP tools to the server.
func RegisterProjectTools ¶
RegisterProjectTools adds project-related MCP tools to the server.
func RegisterProxyTools ¶
func RegisterProxyTools(server *mcp.Server, pm *proxy.ProxyManager)
RegisterProxyTools adds proxy-related MCP tools to the server.
func RegisterResponsiveAuditTool ¶ added in v0.12.0
func RegisterResponsiveAuditTool(server *mcp.Server, dt *DaemonTools, pm *proxy.ProxyManager)
RegisterResponsiveAuditTool registers the responsive_audit tool. Exactly one of dt or pm must be non-nil.
func RegisterSessionTool ¶ added in v0.7.0
func RegisterSessionTool(server *mcp.Server, dt *DaemonTools)
RegisterSessionTool adds the session MCP tool to the server.
func RegisterSnapshotTools ¶
RegisterSnapshotTools registers snapshot-related MCP tools
func RegisterStoreTool ¶ added in v0.8.0
func RegisterStoreTool(server *mcp.Server, dt *DaemonTools)
RegisterStoreTool registers the store MCP tool with the server.
func RegisterTunnelTool ¶
func RegisterTunnelTool(server *mcp.Server, dt *DaemonTools)
RegisterTunnelTool registers the tunnel MCP tool with the server.
func ScanForHints ¶ added in v0.12.44
ScanForHints scans js for raw DOM patterns that duplicate __devtool helpers. Returns a slice of advisory hint messages; empty slice means no hints.
Types ¶
type APICategory ¶
APICategory describes a category of functions.
type APIFunction ¶
type APIFunction struct {
Name string `json:"name"`
Category string `json:"category"`
Description string `json:"description"`
Signature string `json:"signature"`
Parameters []string `json:"parameters,omitempty"`
Returns string `json:"returns"`
Example string `json:"example"`
}
APIFunction describes a single function in the __devtool API.
type APISearchMatch ¶ added in v0.12.44
type APISearchMatch struct {
Name string `json:"name"`
Signature string `json:"signature"`
Category string `json:"category"`
Description string `json:"description"`
}
APISearchMatch is a compact entry returned by SearchAPIFunctions — just enough for the caller to decide which function to describe next without blowing the response budget on full parameter lists and examples.
type APISearchResult ¶ added in v0.12.44
type APISearchResult struct {
Matches []APISearchMatch `json:"matches"`
Count int `json:"count"`
Truncated bool `json:"truncated"`
}
APISearchResult is the response shape for the proxy exec search action.
func SearchAPIFunctions ¶ added in v0.12.44
func SearchAPIFunctions(query, category string) APISearchResult
SearchAPIFunctions filters DevToolAPIFunctions by a case-insensitive substring query across name, description, and signature, with an optional category filter (exact, case-insensitive). Results are ranked by match tier (exact > prefix > substring-in-name > substring-elsewhere) then alphabetically by name, and capped at maxAPISearchResults. An empty query with a category returns everything in that category (still capped). Returns an empty Matches slice (not nil) when nothing matches.
type AutomationEntry ¶ added in v0.11.1
type AutomationEntry struct {
ID string `json:"id"`
State string `json:"state"`
URL string `json:"url,omitempty"`
Headless bool `json:"headless"`
ProxyURL string `json:"proxy_url,omitempty"`
Path string `json:"path,omitempty"`
Error string `json:"error,omitempty"`
}
AutomationEntry represents an automation session in a list response.
type AutomationInput ¶ added in v0.11.1
type AutomationInput struct {
Action string `json:"action" jsonschema:"Action: start, stop, status, list, screenshot, navigate, evaluate"`
ID string `json:"id,omitempty" jsonschema:"Session ID (optional for start, required for stop/status)"`
URL string `json:"url,omitempty" jsonschema:"URL to open (for start/navigate actions)"`
ProxyID string `json:"proxy_id,omitempty" jsonschema:"Proxy to route through (for start action)"`
Headless *bool `json:"headless,omitempty" jsonschema:"Run in headless mode (default: true)"`
Global bool `json:"global,omitempty" jsonschema:"For list: include sessions from all directories"`
Type string `json:"type,omitempty" jsonschema:"Screenshot type: viewport, fullpage, element, clip"`
Label string `json:"label,omitempty" jsonschema:"Label for screenshot filename"`
Selector string `json:"selector,omitempty" jsonschema:"CSS selector for element screenshot"`
Viewport string `json:"viewport,omitempty" jsonschema:"Viewport preset: desktop, mobile, tablet"`
X float64 `json:"x,omitempty" jsonschema:"Clip X coordinate"`
Y float64 `json:"y,omitempty" jsonschema:"Clip Y coordinate"`
Width float64 `json:"width,omitempty" jsonschema:"Clip width"`
Height float64 `json:"height,omitempty" jsonschema:"Clip height"`
Script string `json:"script,omitempty" jsonschema:"JavaScript to evaluate"`
SessionID string `json:"session_id,omitempty" jsonschema:"Session ID for screenshot/navigate/evaluate"`
}
AutomationInput represents input for the automation tool.
type AutomationOutput ¶ added in v0.11.1
type AutomationOutput struct {
ID string `json:"id,omitempty"`
State string `json:"state,omitempty"`
URL string `json:"url,omitempty"`
Headless bool `json:"headless,omitempty"`
ProxyURL string `json:"proxy_url,omitempty"`
Path string `json:"path,omitempty"`
StartedAt string `json:"started_at,omitempty"`
Error string `json:"error,omitempty"`
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
Count int `json:"count"`
Sessions []AutomationEntry `json:"sessions,omitempty"`
// Screenshot fields
ScreenshotPath string `json:"screenshot_path,omitempty"`
Filename string `json:"filename,omitempty"`
ScreenWidth int64 `json:"screen_width,omitempty"`
ScreenHeight int64 `json:"screen_height,omitempty"`
ViewportName string `json:"viewport_name,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
// Evaluate fields
Result interface{} `json:"result,omitempty"`
}
AutomationOutput represents output from the automation tool.
type BrowserEntry ¶ added in v0.11.1
type BrowserEntry struct {
ID string `json:"id"`
State string `json:"state"`
PID int `json:"pid,omitempty"`
URL string `json:"url,omitempty"`
Headless bool `json:"headless"`
ProxyURL string `json:"proxy_url,omitempty"`
Path string `json:"path,omitempty"`
Error string `json:"error,omitempty"`
}
BrowserEntry represents a browser in a list response.
type BrowserInput ¶ added in v0.11.1
type BrowserInput struct {
Action string `json:"action" jsonschema:"Action: start, stop, status, list"`
ID string `json:"id,omitempty" jsonschema:"Browser ID (optional for start, required for stop/status)"`
URL string `json:"url,omitempty" jsonschema:"URL to open (required for start unless proxy_id is provided)"`
ProxyID string `json:"proxy_id,omitempty" jsonschema:"Proxy to use - auto-starts proxy if not found and URL is provided"`
Headless *bool `json:"headless,omitempty" jsonschema:"Run in headless mode (default: true)"`
BinaryPath string `json:"binary_path,omitempty" jsonschema:"Optional path to Chrome binary (auto-detected if empty)"`
Global bool `json:"global,omitempty" jsonschema:"For list: include browsers from all directories (default: false)"`
}
BrowserInput represents input for the browser tool.
type BrowserOutput ¶ added in v0.11.1
type BrowserOutput struct {
ID string `json:"id,omitempty"`
State string `json:"state,omitempty"`
PID int `json:"pid,omitempty"`
URL string `json:"url,omitempty"`
Headless bool `json:"headless,omitempty"`
ProxyStarted bool `json:"proxy_started,omitempty"` // True if proxy was auto-started
ProxyURL string `json:"proxy_url,omitempty"`
BinaryPath string `json:"binary_path,omitempty"`
Path string `json:"path,omitempty"`
StartedAt string `json:"started_at,omitempty"`
Error string `json:"error,omitempty"`
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
Count int `json:"count"`
Browsers []BrowserEntry `json:"browsers,omitempty"`
}
BrowserOutput represents output from the browser tool.
type ChannelReplyInput ¶ added in v0.12.44
type ChannelReplyInput struct {
Content string `json:"content" jsonschema:"required,Message body to send to the developer (markdown OK)"`
ProxyID string `json:"proxy_id,omitempty" jsonschema:"Target a specific proxy; omit to fan out to all active proxies"`
Severity string `json:"severity,omitempty" jsonschema:"enum=info,enum=warning,enum=error,Toast styling (default: info)"`
Title string `json:"title,omitempty" jsonschema:"Toast title"`
}
ChannelReplyInput is the input for the channel_reply tool.
type ChannelReplyOutput ¶ added in v0.12.44
ChannelReplyOutput is the output for the channel_reply tool.
type ChannelSessionHandle ¶ added in v0.12.44
type ChannelSessionHandle struct {
// contains filtered or unexported fields
}
ChannelSessionHandle manages the lifecycle of a daemon session registered by agnt mcp in channel mode. Call Close to unregister the session and stop the heartbeat. The handle owns the heartbeat goroutine's cancel function so Close() signals the goroutine via context cancellation — no shared stop-channel field on DaemonTools, no Close-vs-Init race.
func (*ChannelSessionHandle) Close ¶ added in v0.12.44
func (h *ChannelSessionHandle) Close()
Close unregisters the channel session from the daemon and stops the heartbeat goroutine. stopOnce guarantees the ctx cancel + daemon unregister pair fire exactly once, even under concurrent Close calls.
type ChannelSink ¶ added in v0.12.44
type ChannelSink struct {
// contains filtered or unexported fields
}
ChannelSink bridges daemon StreamSink events to MCP channel notifications. It extracts message/severity/location from LogEntry union types, sanitizes meta keys, deduplicates within a configurable window, and filters by severity.
func NewChannelSink ¶ added in v0.12.44
func NewChannelSink(cfg *config.ChannelConfig, notify NotifyFunc) *ChannelSink
NewChannelSink creates a channel sink with the given config and notify function.
func (*ChannelSink) HandleEntry ¶ added in v0.12.44
func (s *ChannelSink) HandleEntry(ctx context.Context, entry proxy.LogEntry)
HandleEntry processes a single LogEntry and emits a channel notification if it passes severity filtering and deduplication.
func (*ChannelSink) SetNowFunc ¶ added in v0.12.44
func (s *ChannelSink) SetNowFunc(fn func() time.Time)
SetNowFunc overrides the clock function (for tests).
type ChaosConfigInput ¶
type ChaosConfigInput struct {
Enabled bool `json:"enabled"`
Rules []ChaosRuleInput `json:"rules,omitempty"`
GlobalOdds float64 `json:"global_odds,omitempty"` // 0.0-1.0
Seed int64 `json:"seed,omitempty"` // For reproducible chaos
LoggingMode int `json:"logging_mode,omitempty"` // 0=silent, 1=testing, 2=coordinated
}
ChaosConfigInput defines input for full chaos configuration.
type ChaosRuleInput ¶
type ChaosRuleInput struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Type string `json:"type"` // latency, out_of_order, slow_drip, disconnect, http_error, truncate, etc.
Enabled bool `json:"enabled"`
URLPattern string `json:"url_pattern,omitempty"`
Methods []string `json:"methods,omitempty"`
Probability float64 `json:"probability,omitempty"` // 0.0-1.0, default 1.0
// Latency config
MinLatencyMs int `json:"min_latency_ms,omitempty"`
MaxLatencyMs int `json:"max_latency_ms,omitempty"`
JitterMs int `json:"jitter_ms,omitempty"`
// Slow-drip config
BytesPerMs int `json:"bytes_per_ms,omitempty"`
ChunkSize int `json:"chunk_size,omitempty"`
// Connection drop config
DropAfterPercent float64 `json:"drop_after_percent,omitempty"`
DropAfterBytes int64 `json:"drop_after_bytes,omitempty"`
// Error injection config
ErrorCodes []int `json:"error_codes,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
// Truncation config
TruncatePercent float64 `json:"truncate_percent,omitempty"`
// Out-of-order config
ReorderMinRequests int `json:"reorder_min_requests,omitempty"`
ReorderMaxWaitMs int `json:"reorder_max_wait_ms,omitempty"`
// Stale config
StaleDelayMs int64 `json:"stale_delay_ms,omitempty"`
}
ChaosRuleInput defines input for a single chaos rule.
type ChaosRuleOutput ¶
type ChaosRuleOutput struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
URLPattern string `json:"url_pattern,omitempty"`
Methods []string `json:"methods,omitempty"`
Probability float64 `json:"probability"`
TimesApplied int64 `json:"times_applied"`
}
ChaosRuleOutput represents a chaos rule in the output.
type ChaosStatsOutput ¶
type ChaosStatsOutput struct {
TotalRequests int64 `json:"total_requests"`
AffectedCount int64 `json:"affected_count"`
LatencyInjected int64 `json:"latency_injected_ms"`
ErrorsInjected int64 `json:"errors_injected"`
DropsInjected int64 `json:"drops_injected"`
TruncatedCount int64 `json:"truncated_count"`
ReorderedCount int64 `json:"reordered_count"`
RuleStats map[string]int64 `json:"rule_stats,omitempty"`
}
ChaosStatsOutput holds chaos engine statistics.
type CompactError ¶ added in v0.7.12
type CompactError struct {
Message string `json:"message"`
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
Location string `json:"location,omitempty"` // "file.js:123:45" format
StackPreview string `json:"stack_preview,omitempty"` // First 3 lines of stack trace
Timestamp string `json:"timestamp,omitempty"`
}
CompactError represents a frontend error with truncated verbose fields. Used when detail: ["errors"] is specified to avoid token overflow.
type CompactHTTPRequest ¶ added in v0.7.12
type CompactHTTPRequest struct {
Method string `json:"method"`
URL string `json:"url"`
StatusCode int `json:"status_code"`
Duration int64 `json:"duration_ms"`
Timestamp time.Time `json:"timestamp,omitempty"`
Error string `json:"error,omitempty"`
}
CompactHTTPRequest represents a compact HTTP request/response.
type CompactInteraction ¶ added in v0.7.12
type CompactInteraction struct {
Type string `json:"type"`
Target string `json:"target,omitempty"` // CSS selector or element description
Timestamp time.Time `json:"timestamp,omitempty"`
}
CompactInteraction represents a compact user interaction.
type CompactLogEntry ¶ added in v0.7.12
type CompactLogEntry struct {
Type string `json:"type"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
}
CompactLogEntry represents a compact log entry for other types.
type CompactMutation ¶ added in v0.7.12
type CompactMutation struct {
Type string `json:"type"` // added, removed, modified
Target string `json:"target,omitempty"`
Count int `json:"count,omitempty"` // Number of nodes affected
Timestamp time.Time `json:"timestamp,omitempty"`
}
CompactMutation represents a compact DOM mutation.
type CompactPerformance ¶ added in v0.7.12
type CompactPerformance struct {
URL string `json:"url"`
LoadTimeMs int64 `json:"load_time_ms"`
FirstPaintMs int64 `json:"first_paint_ms,omitempty"`
DOMContentLoaded int64 `json:"dom_content_loaded_ms,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
}
CompactPerformance represents compact performance metrics.
type CurrentPageInput ¶
type CurrentPageInput struct {
ProxyID string `json:"proxy_id" jsonschema:"Proxy ID to query pages from"`
Action string `json:"action,omitempty" jsonschema:"Action: list, get, summary, clear (default: list)"`
SessionID string `json:"session_id,omitempty" jsonschema:"Specific session ID (required for get/summary action)"`
Detail []string `` /* 130-byte string literal not displayed */
Limit int `json:"limit,omitempty" jsonschema:"For summary: max items per detailed section (default: 5, max: 100)"`
Raw bool `json:"raw,omitempty" jsonschema:"For get: return full arrays with all details instead of compact format (default: false)"`
}
CurrentPageInput defines input for the currentpage tool.
type CurrentPageOutput ¶
type CurrentPageOutput struct {
// For list
Sessions []PageSessionOutput `json:"sessions,omitempty"`
Count int `json:"count"`
Hint string `json:"hint,omitempty"`
// For get
Session *PageSessionOutput `json:"session,omitempty"`
// For summary
Summary *PageSummaryOutput `json:"summary,omitempty"`
// For clear
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
}
CurrentPageOutput defines output for currentpage tool.
type DaemonInput ¶
type DaemonInput struct {
Action string `json:"action" jsonschema:"Action: status, info, start, stop, restart, stop_all, restart_all, startup_log, doctor"`
}
DaemonInput defines input for the daemon management tool.
type DaemonOutput ¶
type DaemonOutput struct {
// For status
Running bool `json:"running"`
SocketPath string `json:"socket_path,omitempty"`
// For info
Version string `json:"version,omitempty"`
Uptime string `json:"uptime,omitempty"`
ClientCount int64 `json:"client_count,omitempty"`
ProcessInfo *ProcessInfo `json:"process_info,omitempty"`
ProxyInfo *ProxyInfo `json:"proxy_info,omitempty"`
// For stop_all/restart_all
ProcessesStopped int `json:"processes_stopped,omitempty"`
ProxiesStopped int `json:"proxies_stopped,omitempty"`
ProcessesStarted int `json:"processes_started,omitempty"`
ProxiesStarted int `json:"proxies_started,omitempty"`
ProcessesFailed int `json:"processes_failed,omitempty"`
ProxiesFailed int `json:"proxies_failed,omitempty"`
// For all actions
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
}
DaemonOutput defines output for daemon management.
type DaemonTools ¶
type DaemonTools struct {
// contains filtered or unexported fields
}
DaemonTools wraps a daemon client for MCP tool handlers.
func NewDaemonTools ¶
func NewDaemonTools(config daemon.AutoStartConfig, version string) *DaemonTools
NewDaemonTools creates a new daemon tools wrapper with auto-start and version checking. The version parameter should be the current binary version (e.g., "0.6.5").
func (*DaemonTools) AlertSink ¶ added in v0.11.5
func (dt *DaemonTools) AlertSink() daemon.MCPAlertSink
AlertSink returns the current MCP alert sink, if any.
func (*DaemonTools) ChannelSessionCode ¶ added in v0.12.44
func (dt *DaemonTools) ChannelSessionCode() string
ChannelSessionCode returns the session code for the active channel session, or empty string if none is registered.
func (*DaemonTools) Close ¶
func (dt *DaemonTools) Close() error
Close closes the daemon client connection.
func (*DaemonTools) RegisterChannelSession ¶ added in v0.12.44
func (dt *DaemonTools) RegisterChannelSession(ctx context.Context, cfg *config.ChannelConfig, projectPath string) *ChannelSessionHandle
RegisterChannelSession registers a daemon session for the MCP process when running in channel mode. In channel mode there is no PTY child, so SessionPGID is 0 (pgid cleanup is a no-op; managed processes still clean up normally via the daemon's ProcessManager). Returns a handle that must be closed on shutdown to unregister the session and stop the heartbeat. Returns nil if channel mode is disabled.
func (*DaemonTools) RunAutostart ¶ added in v0.12.44
func (dt *DaemonTools) RunAutostart(projectDir string) (map[string]interface{}, error)
RunAutostart triggers a non-interactive autostart for the given project directory via the daemon. Used by the MCP InitializedHandler in channel mode. Returns the raw autostart result map from the daemon.
func (*DaemonTools) SessionCode ¶ added in v0.7.12
func (dt *DaemonTools) SessionCode() string
SessionCode returns the current attached session code.
func (*DaemonTools) SetAlertSink ¶ added in v0.11.5
func (dt *DaemonTools) SetAlertSink(sink daemon.MCPAlertSink)
SetAlertSink sets the MCP alert sink for delivering process output alerts.
func (*DaemonTools) SetNoAutoAttach ¶ added in v0.7.12
func (dt *DaemonTools) SetNoAutoAttach(noAttach bool)
SetNoAutoAttach disables automatic session attachment on connect. Call this before any tool calls if you want to operate globally.
func (*DaemonTools) SetSessionCode ¶ added in v0.7.12
func (dt *DaemonTools) SetSessionCode(code string)
SetSessionCode sets the session code directly (useful for testing or explicit attachment).
func (*DaemonTools) StartChannelSink ¶ added in v0.12.44
func (dt *DaemonTools) StartChannelSink(server *mcp.Server, cfg *config.ChannelConfig, projectPath string) context.CancelFunc
StartChannelSink starts a goroutine that subscribes to daemon StreamEvents and forwards matching entries as MCP channel notifications. Returns a cancel function to stop the sink. No-op and returns nil if channel is not enabled. projectPath scopes the subscription to proxies for that project directory; pass "" to receive events from all proxies (legacy behavior).
type DetectInput ¶
type DetectInput struct {
Path string `json:"path,omitempty" jsonschema:"Directory path (defaults to current dir)"`
}
DetectInput defines input for the detect tool.
type DetectOutput ¶
type DetectOutput struct {
Type string `json:"type"`
Name string `json:"name"`
Scripts []string `json:"scripts"`
PackageManager string `json:"package_manager,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
DetectOutput defines output for detect.
type DualBackend ¶ added in v0.12.45
type DualBackend[D, L any] struct { Daemon *D Legacy *L }
DualBackend holds either a daemon client or a legacy direct-access value, and dispatches to the appropriate path based on which is non-nil. D is the daemon type, L is the legacy type.
Usage:
b := DualBackend[DaemonTools, proxy.ProxyManager]{Daemon: dt, Legacy: pm}
result, err := b.Dispatch(
func(d *DaemonTools) (T, error) { ... },
func(l *proxy.ProxyManager) (T, error) { ... },
)
type ErrorSummary ¶ added in v0.7.0
type ErrorSummary struct {
Message string `json:"message"`
Type string `json:"type,omitempty"`
Count int `json:"count"`
}
ErrorSummary represents a deduplicated error with occurrence count.
type GetErrorsInput ¶ added in v0.12.0
type GetErrorsInput struct {
ProcessID string `json:"process_id,omitempty" jsonschema:"Filter to specific process"`
ProxyID string `json:"proxy_id,omitempty" jsonschema:"Filter to specific proxy (default: all active proxies)"`
Since string `json:"since,omitempty" jsonschema:"Override recency filter (RFC3339 or duration like '5m')"`
IncludeWarnings *bool `json:"include_warnings,omitempty" jsonschema:"Include warnings (default: true)"`
Limit int `json:"limit,omitempty" jsonschema:"Max errors to return (default: 25)"`
Raw bool `json:"raw,omitempty" jsonschema:"Return full JSON with all fields"`
}
GetErrorsInput is the input for the get_errors tool.
type GetErrorsOutput ¶ added in v0.12.0
type GetErrorsOutput struct {
ErrorCount int `json:"error_count"`
WarningCount int `json:"warning_count"`
Summary string `json:"summary,omitempty"`
}
GetErrorsOutput is the output for the get_errors tool.
type LogEntryOutput ¶
type LogEntryOutput struct {
Type string `json:"type"`
Timestamp time.Time `json:"timestamp"`
Data string `json:"data"`
}
LogEntryOutput represents a log entry in the output.
type LogStatsOutput ¶
type LogStatsOutput struct {
TotalEntries int64 `json:"total_entries"`
AvailableEntries int64 `json:"available_entries"`
MaxSize int64 `json:"max_size"`
Dropped int64 `json:"dropped"`
}
LogStatsOutput holds logger statistics.
type NotifyFunc ¶ added in v0.12.44
NotifyFunc sends a notification with the given method and params. In production this wraps ServerSession.Notify; in tests it captures calls.
type PageSessionOutput ¶
type PageSessionOutput struct {
ID string `json:"id"`
URL string `json:"url"`
PageTitle string `json:"page_title,omitempty"`
StartTime time.Time `json:"start_time"`
LastActivity time.Time `json:"last_activity"`
Active bool `json:"active"`
ResourceCount int `json:"resource_count"`
ErrorCount int `json:"error_count"`
HasPerformance bool `json:"has_performance"`
LoadTime int64 `json:"load_time_ms,omitempty"`
Resources []string `json:"resources,omitempty"` // URLs of resources
Errors []map[string]interface{} `json:"errors,omitempty"`
// Interaction tracking
InteractionCount int `json:"interaction_count"`
Interactions []map[string]interface{} `json:"interactions,omitempty"` // Detailed view only
// Mutation tracking
MutationCount int `json:"mutation_count"`
Mutations []map[string]interface{} `json:"mutations,omitempty"` // Detailed view only
}
PageSessionOutput represents a page session in the output.
func (PageSessionOutput) MarshalJSON ¶
func (o PageSessionOutput) MarshalJSON() ([]byte, error)
type PageSummaryOutput ¶ added in v0.7.0
type PageSummaryOutput struct {
ID string `json:"id"`
URL string `json:"url"`
PageTitle string `json:"page_title,omitempty"`
StartTime time.Time `json:"start_time"`
LastActivity time.Time `json:"last_activity"`
Active bool `json:"active"`
// Resource summary
ResourceCount int `json:"resource_count"`
ResourcesByType map[string]int `json:"resources_by_type,omitempty"` // e.g., {"js": 5, "css": 3, "img": 10}
TotalPayloadSize int64 `json:"total_payload_size,omitempty"`
Resources []string `json:"resources,omitempty"` // Full list when detail=["resources"]
// Error summary
ErrorCount int `json:"error_count"`
UniqueErrors []ErrorSummary `json:"unique_errors,omitempty"` // Deduplicated errors with counts
ErrorsByType map[string]int `json:"errors_by_type,omitempty"` // e.g., {"ReferenceError": 3}
Errors []CompactError `json:"errors,omitempty"` // Compact error list when detail=["errors"]
// Performance
LoadTimeMs int64 `json:"load_time_ms,omitempty"`
FirstPaintMs int64 `json:"first_paint_ms,omitempty"`
DOMContentLoaded int64 `json:"dom_content_loaded_ms,omitempty"`
// Interaction summary
InteractionCount int `json:"interaction_count"`
InteractionsByType map[string]int `json:"interactions_by_type,omitempty"` // e.g., {"click": 5, "scroll": 10}
RecentInteractions []map[string]interface{} `json:"recent_interactions,omitempty"` // Last N (default 5)
Interactions []map[string]interface{} `json:"interactions,omitempty"` // Full list when detail=["interactions"]
// Mutation summary
MutationCount int `json:"mutation_count"`
MutationsByType map[string]int `json:"mutations_by_type,omitempty"` // e.g., {"added": 10, "modified": 5}
RecentMutations []map[string]interface{} `json:"recent_mutations,omitempty"` // Last N (default 5)
Mutations []map[string]interface{} `json:"mutations,omitempty"` // Full list when detail=["mutations"]
// Page dimensions (if available from client)
PageHeight int `json:"page_height,omitempty"`
PageWidth int `json:"page_width,omitempty"`
ViewportHeight int `json:"viewport_height,omitempty"`
ViewportWidth int `json:"viewport_width,omitempty"`
// Detail info
DetailSections []string `json:"detail_sections,omitempty"` // Which sections have full detail
DetailLimit int `json:"detail_limit,omitempty"` // Limit applied to detailed sections
}
PageSummaryOutput provides a compact summary of a large page without blowing context.
type Pagination ¶ added in v0.12.9
type Pagination struct {
Count int `json:"count"`
TotalAvailable int `json:"total_available"`
Limit int `json:"limit"`
Filtered bool `json:"filtered,omitempty"`
}
Pagination provides context for list/query results. Count, TotalAvailable, and Limit never use omitempty so zero values are visible.
func NewPagination ¶ added in v0.12.9
func NewPagination(count, totalAvailable, limit int, filtered bool) Pagination
NewPagination creates a Pagination with all fields set.
type ProcEntry ¶
type ProcEntry struct {
ID string `json:"id"`
Command string `json:"command"`
State string `json:"state"`
Summary string `json:"summary"`
Runtime string `json:"runtime"`
ProjectPath string `json:"project_path,omitempty"`
ScriptName string `json:"script_name,omitempty"`
// Role classification — what kind of process this is and what it produces.
Role string `json:"role,omitempty"`
Produces []string `json:"produces,omitempty"`
OutputHint string `json:"output_hint,omitempty"`
// Last known death record — see ProcOutput for field semantics.
LastExitAt string `json:"last_exit_at,omitempty"`
LastExitCode *int `json:"last_exit_code,omitempty"`
LastExitReason string `json:"last_exit_reason,omitempty"`
LastUptime string `json:"last_uptime,omitempty"`
LastStderrTail string `json:"last_stderr_tail,omitempty"`
}
ProcEntry is a process in the list.
type ProcInput ¶
type ProcInput struct {
Action string `` /* 143-byte string literal not displayed */
ProcessID string `json:"process_id,omitempty" jsonschema:"Process ID (required for status/output/stop/restart/autorestart/find)"`
// Script actions
ScriptName string `json:"script_name,omitempty" jsonschema:"Script name (required for script_output/script_history)"`
// Output filters
Stream string `json:"stream,omitempty" jsonschema:"stdout, stderr, or combined (default)"`
Tail int `json:"tail,omitempty" jsonschema:"Last N lines only"`
Head int `json:"head,omitempty" jsonschema:"First N lines only"`
Grep string `json:"grep,omitempty" jsonschema:"Filter lines matching regex pattern"`
GrepV bool `json:"grep_v,omitempty" jsonschema:"Invert grep (exclude matching lines)"`
// Find options
What string `` /* 140-byte string literal not displayed */
// Stop options
Force bool `json:"force,omitempty" jsonschema:"For stop: force kill immediately"`
// Cleanup options
Port int `json:"port,omitempty" jsonschema:"Port number (required for cleanup_port)"`
// Directory filtering
Global bool `json:"global,omitempty" jsonschema:"For list: include processes from all directories (default: false)"`
// Auto-restart options
AutoRestartEnable bool `json:"auto_restart_enable,omitempty" jsonschema:"For autorestart: enable (true) or disable (false)"`
MaxRestarts int `json:"max_restarts,omitempty" jsonschema:"For autorestart: max restarts per minute (default: 5, 0=unlimited)"`
OnlyOnError bool `json:"only_on_error,omitempty" jsonschema:"For autorestart: only restart on non-zero exit code"`
}
ProcInput defines input for the proc tool.
type ProcOutput ¶
type ProcOutput struct {
// For status
ProcessID string `json:"process_id,omitempty"`
State string `json:"state,omitempty"`
Summary string `json:"summary,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Runtime string `json:"runtime,omitempty"`
// Role classification — what kind of process this is and what it produces.
// Role values: "build-watch", "dev-server", "test-runner", "script", "unknown"
// Produces values: "build-output", "test-results", "logs", "hot-reload"
Role string `json:"role,omitempty"`
Produces []string `json:"produces,omitempty"`
OutputHint string `json:"output_hint,omitempty"` // advisory: how to query this process output
// Last known death record — populated when the process has exited
// (cleanly or via crash/signal) within the retention window. Lets the
// agent tell "never started" from "started and died at T".
LastExitAt string `json:"last_exit_at,omitempty"`
LastExitCode *int `json:"last_exit_code,omitempty"`
LastExitReason string `json:"last_exit_reason,omitempty"` // "stopped" | "crash" | "signal"
LastUptime string `json:"last_uptime,omitempty"`
LastStderrTail string `json:"last_stderr_tail,omitempty"`
// For output
Output string `json:"output,omitempty"`
Lines int `json:"lines,omitempty"`
Truncated bool `json:"truncated,omitempty"`
// For list
Count int `json:"count"`
Processes []ProcEntry `json:"processes,omitempty"`
ProjectPath string `json:"project_path,omitempty"`
SessionCode string `json:"session_code,omitempty"`
Global bool `json:"global,omitempty"`
// For stop
Success bool `json:"success,omitempty"`
// For cleanup_port
KilledPIDs []int `json:"killed_pids,omitempty"`
Message string `json:"message,omitempty"`
}
ProcOutput defines output for proc.
type ProcessInfo ¶
type ProcessInfo struct {
Active int64 `json:"active"`
TotalStarted int64 `json:"total_started"`
TotalFailed int64 `json:"total_failed"`
}
ProcessInfo holds process manager statistics.
type ProcessRole ¶ added in v0.12.48
type ProcessRole struct {
Role string // "build-watch", "dev-server", "test-runner", "script", "unknown"
Produces []string // "build-output", "test-results", "logs", "hot-reload"
OutputHint string // advisory message for querying output
}
ProcessRole describes the role of a running process.
type ProxyEntry ¶
type ProxyEntry struct {
ID string `json:"id"`
TargetURL string `json:"target_url"`
ListenAddr string `json:"listen_addr"`
BindAddress string `json:"bind_address,omitempty"`
PublicURL string `json:"public_url,omitempty"`
Path string `json:"path,omitempty"`
Running bool `json:"running"`
Uptime string `json:"uptime"`
TotalRequests int64 `json:"total_requests"`
TunnelURL string `json:"tunnel_url,omitempty"`
TunnelRunning bool `json:"tunnel_running,omitempty"`
// Readiness-gate fields: populated when the proxy is waiting on
// declared `wait-for` dependencies. State is
// "waiting_for_dependencies" while gating, "running" otherwise.
State string `json:"state,omitempty"`
WaitingOn []string `json:"waiting_on,omitempty"`
}
ProxyEntry represents a proxy in the list.
type ProxyInput ¶
type ProxyInput struct {
Action string `json:"action" jsonschema:"Action: start, stop, status, list, exec, toast, chaos"`
ID string `json:"id,omitempty" jsonschema:"Proxy ID (required for start/stop/status/exec/toast/chaos)"`
TargetURL string `json:"target_url,omitempty" jsonschema:"Target URL to proxy (required for start)"`
Port int `` /* 126-byte string literal not displayed */
MaxLogSize int `json:"max_log_size,omitempty" jsonschema:"Maximum log entries (default: 1000)"`
BindAddress string `` /* 150-byte string literal not displayed */
AllowExternal bool `` /* 141-byte string literal not displayed */
PublicURL string `` /* 159-byte string literal not displayed */
SkipTLSVerify bool `` /* 180-byte string literal not displayed */
Code string `json:"code,omitempty" jsonschema:"JavaScript code to execute (required for exec)"`
Global bool `json:"global,omitempty" jsonschema:"For list: include proxies from all directories (default: false)"`
Help bool `json:"help,omitempty" jsonschema:"For exec: show __devtool API overview instead of executing code"`
Describe string `` /* 140-byte string literal not displayed */
Search string `` /* 218-byte string literal not displayed */
Category string `` /* 156-byte string literal not displayed */
Hints *bool `` /* 152-byte string literal not displayed */
ToastType string `json:"toast_type,omitempty" jsonschema:"For toast: notification type (success, error, warning, info). Default: info"`
ToastTitle string `json:"toast_title,omitempty" jsonschema:"For toast: notification title (optional)"`
ToastMessage string `json:"toast_message,omitempty" jsonschema:"For toast: notification message (required for toast)"`
ToastDuration int `json:"toast_duration,omitempty" jsonschema:"For toast: duration in milliseconds (0 for default)"`
// Tunnel configuration (for start action)
Tunnel string `` /* 129-byte string literal not displayed */
TunnelArgs []string `json:"tunnel_args,omitempty" jsonschema:"Additional arguments for tunnel command"`
TunnelToken string `json:"tunnel_token,omitempty" jsonschema:"Authentication token for tunnel (e.g., ngrok authtoken)"`
TunnelRegion string `json:"tunnel_region,omitempty" jsonschema:"Tunnel region (optional)"`
TunnelCommand string `json:"tunnel_command,omitempty" jsonschema:"Custom tunnel command (when tunnel is 'custom'). Use {{PORT}} as placeholder."`
// Chaos-related fields
ChaosOperation string `` /* 142-byte string literal not displayed */
ChaosPreset string `` /* 160-byte string literal not displayed */
ChaosRules []ChaosRuleInput `json:"chaos_rules,omitempty" jsonschema:"For chaos set: array of chaos rules to configure"`
ChaosRule *ChaosRuleInput `json:"chaos_rule,omitempty" jsonschema:"For chaos add_rule: single rule to add"`
ChaosRuleID string `json:"chaos_rule_id,omitempty" jsonschema:"For chaos remove_rule: ID of rule to remove"`
ChaosConfig *ChaosConfigInput `json:"chaos_config,omitempty" jsonschema:"For chaos set: full chaos configuration"`
}
ProxyInput defines input for the proxy tool.
type ProxyLogInput ¶
type ProxyLogInput struct {
ProxyID string `json:"proxy_id" jsonschema:"Proxy ID to query logs from"`
Action string `json:"action,omitempty" jsonschema:"Action: query (default), summary, clear, stats"`
Types []string `` /* 157-byte string literal not displayed */
Methods []string `json:"methods,omitempty" jsonschema:"HTTP methods to filter (e.g., GET, POST)"`
URLPattern string `json:"url_pattern,omitempty" jsonschema:"URL pattern to match (substring)"`
StatusCodes []int `json:"status_codes,omitempty" jsonschema:"HTTP status codes to filter"`
Limit int `json:"limit,omitempty" jsonschema:"Maximum number of entries (default: 100)"`
Since string `json:"since,omitempty" jsonschema:"Start time filter (RFC3339 or duration like '5m')"`
Until string `json:"until,omitempty" jsonschema:"End time filter (RFC3339)"`
Raw bool `json:"raw,omitempty" jsonschema:"Return full JSON dumps instead of compact format"`
ErrorsOnly bool `json:"errors_only,omitempty" jsonschema:"Filter to errors only (HTTP 4xx/5xx, JS errors, diagnostics)"`
DiagnosticLevels []string `json:"diagnostic_levels,omitempty" jsonschema:"Diagnostic levels to include: error, warning, info"`
Detail []string `` /* 145-byte string literal not displayed */
}
ProxyLogInput defines input for the proxylog tool.
type ProxyLogOutput ¶
type ProxyLogOutput struct {
// For query
Entries []LogEntryOutput `json:"entries,omitempty"`
Pagination *Pagination `json:"pagination,omitempty"`
// For summary
Summary *ProxyLogSummary `json:"summary,omitempty"`
// For stats
Stats *LogStatsOutput `json:"stats,omitempty"`
// For clear
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
}
ProxyLogOutput defines output for proxylog tool.
type ProxyLogSummary ¶ added in v0.7.12
type ProxyLogSummary struct {
TotalEntries int `json:"total_entries"`
EntriesByType map[string]int `json:"entries_by_type"` // e.g., {"error": 150, "http": 300}
TimeRange TimeRange `json:"time_range,omitempty"`
// Error summary
ErrorCount int `json:"error_count"`
UniqueErrors []ErrorSummary `json:"unique_errors,omitempty"` // Top 10 deduplicated errors
ErrorsByType map[string]int `json:"errors_by_type,omitempty"` // e.g., {"ReferenceError": 3}
Errors []CompactError `json:"errors,omitempty"` // Full list when detail includes "errors"
RecentErrors []CompactError `json:"recent_errors,omitempty"` // Last 5 errors (when detail not specified)
// HTTP summary
HTTPCount int `json:"http_count"`
HTTPByStatus map[string]int `json:"http_by_status,omitempty"` // e.g., {"2xx": 100, "4xx": 5}
HTTPByMethod map[string]int `json:"http_by_method,omitempty"` // e.g., {"GET": 80, "POST": 20}
HTTPRequests []CompactHTTPRequest `json:"http_requests,omitempty"` // Full list when detail includes "http"
RecentHTTP []CompactHTTPRequest `json:"recent_http,omitempty"` // Last 5 requests (when detail not specified)
// Performance summary
PerformanceCount int `json:"performance_count"`
AvgLoadTime int64 `json:"avg_load_time_ms,omitempty"`
Performance []CompactPerformance `json:"performance,omitempty"` // Full list when detail includes "performance"
RecentPerformance []CompactPerformance `json:"recent_performance,omitempty"` // Last 5 (when detail not specified)
// Interaction summary
InteractionCount int `json:"interaction_count"`
InteractionsByType map[string]int `json:"interactions_by_type,omitempty"` // e.g., {"click": 50, "scroll": 100}
Interactions []CompactInteraction `json:"interactions,omitempty"` // Full list when detail includes "interactions"
RecentInteractions []CompactInteraction `json:"recent_interactions,omitempty"` // Last 5 (when detail not specified)
// Mutation summary
MutationCount int `json:"mutation_count"`
MutationsByType map[string]int `json:"mutations_by_type,omitempty"` // e.g., {"added": 10, "modified": 5}
Mutations []CompactMutation `json:"mutations,omitempty"` // Full list when detail includes "mutations"
RecentMutations []CompactMutation `json:"recent_mutations,omitempty"` // Last 5 (when detail not specified)
// Other log types (custom, panel_message, sketch, etc.)
OtherCount int `json:"other_count,omitempty"`
OtherTypes map[string]int `json:"other_types,omitempty"` // Counts for custom, panel_message, sketch, etc.
Other []CompactLogEntry `json:"other,omitempty"` // Full list when detail includes "other"
// Detail info
DetailSections []string `json:"detail_sections,omitempty"` // Which sections have full detail
DetailLimit int `json:"detail_limit,omitempty"` // Limit applied to detailed sections
}
ProxyLogSummary provides a compact summary of proxy logs.
type ProxyOutput ¶
type ProxyOutput struct {
// For start
ID string `json:"id,omitempty"`
TargetURL string `json:"target_url,omitempty"`
ListenAddr string `json:"listen_addr,omitempty"`
BindAddress string `json:"bind_address,omitempty"`
PublicURL string `json:"public_url,omitempty"`
TunnelURL string `json:"tunnel_url,omitempty"` // Public tunnel URL if tunnel is configured
// For status
Running bool `json:"running,omitempty"`
Uptime string `json:"uptime,omitempty"`
TotalRequests int64 `json:"total_requests,omitempty"`
LogStats *LogStatsOutput `json:"log_stats,omitempty"`
Tunnel *TunnelStatus `json:"tunnel,omitempty"` // Tunnel status if configured
// Readiness-gate state: when a proxy declares `wait-for`, it
// binds immediately but does not forward until every listed
// script signals ready. State is "waiting_for_dependencies"
// while gating, "running" once the gate opens.
State string `json:"state,omitempty"`
WaitingOn []string `json:"waiting_on,omitempty"`
// For list
Count int `json:"count"`
Proxies []ProxyEntry `json:"proxies,omitempty"`
ProjectPath string `json:"project_path,omitempty"`
SessionCode string `json:"session_code,omitempty"`
Global bool `json:"global,omitempty"`
// For stop/exec
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
ExecutionID string `json:"execution_id,omitempty"` // For exec action
// For exec search
SearchResult *APISearchResult `json:"search_result,omitempty"`
// For exec: advisory hints when raw DOM patterns duplicate __devtool helpers
ExecHints []string `json:"hints,omitempty"`
// For chaos
ChaosEnabled bool `json:"chaos_enabled,omitempty"`
ChaosStats *ChaosStatsOutput `json:"chaos_stats,omitempty"`
ChaosRules []ChaosRuleOutput `json:"chaos_rules,omitempty"`
ChaosPresets []string `json:"chaos_presets,omitempty"`
}
ProxyOutput defines output for proxy tool.
type ResponsiveAuditInput ¶ added in v0.12.0
type ResponsiveAuditInput struct {
ProxyID string `json:"proxy_id" jsonschema:"Proxy ID to run audit on"`
Viewports []ViewportInput `json:"viewports,omitempty" jsonschema:"Custom viewports to test (default: mobile/tablet/desktop)"`
Checks []string `json:"checks,omitempty" jsonschema:"Checks to run: layout, overflow, a11y (default: all)"`
Timeout int `json:"timeout,omitempty" jsonschema:"Load timeout per viewport in ms (default: 10000)"`
Raw bool `json:"raw,omitempty" jsonschema:"Return full JSON instead of compact text"`
}
ResponsiveAuditInput defines input for the responsive_audit tool.
type ResponsiveAuditOutput ¶ added in v0.12.0
type ResponsiveAuditOutput struct {
Summary string `json:"summary"`
Raw any `json:"raw,omitempty"`
}
ResponsiveAuditOutput defines output for the responsive_audit tool.
type RunInput ¶
type RunInput struct {
Path string `json:"path,omitempty" jsonschema:"Project directory (defaults to current dir)"`
ScriptName string `json:"script_name,omitempty" jsonschema:"Script name from detect (e.g. test, lint, build)"`
Raw bool `json:"raw,omitempty" jsonschema:"Raw mode: use command and args directly"`
Command string `json:"command,omitempty" jsonschema:"Raw mode: executable to run"`
Args []string `json:"args,omitempty" jsonschema:"Extra args (appended in script mode, used directly in raw mode)"`
ID string `json:"id,omitempty" jsonschema:"Process ID (auto-generated if empty)"`
Mode RunMode `json:"mode,omitempty" jsonschema:"Execution mode: background (default), foreground, foreground-raw"`
NoAutoRestart bool `` /* 133-byte string literal not displayed */
}
RunInput defines input for the run tool.
type RunMode ¶
type RunMode string
RunMode specifies how the run tool executes and returns results.
const ( // RunModeBackground starts process in background, returns process_id for tracking (default) RunModeBackground RunMode = "background" // RunModeForeground waits for completion, returns exit code (output via proc) RunModeForeground RunMode = "foreground" // RunModeForegroundRaw waits for completion, returns exit code and full output RunModeForegroundRaw RunMode = "foreground-raw" )
type RunOutput ¶
type RunOutput struct {
ProcessID string `json:"process_id"`
PID int `json:"pid"`
Command string `json:"command"`
// Foreground mode fields
ExitCode int `json:"exit_code,omitempty"`
State string `json:"state,omitempty"`
Runtime string `json:"runtime,omitempty"`
// Foreground-raw mode fields
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
}
RunOutput defines output for run.
type SessionEntry ¶ added in v0.7.0
type SessionEntry struct {
Code string `json:"code"`
OverlayPath string `json:"overlay_path,omitempty"`
ProjectPath string `json:"project_path,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
StartedAt time.Time `json:"started_at,omitempty"`
Status string `json:"status,omitempty"`
LastSeen time.Time `json:"last_seen,omitempty"`
}
SessionEntry represents a session in the list.
type SessionInput ¶ added in v0.7.0
type SessionInput struct {
Action string `json:"action" jsonschema:"Action: list, send, schedule, tasks, cancel, get"`
Code string `json:"code,omitempty" jsonschema:"Session code (required for send, schedule, get)"`
Message string `json:"message,omitempty" jsonschema:"Message to send or schedule (required for send, schedule)"`
Duration string `json:"duration,omitempty" jsonschema:"Duration for scheduling (e.g. '5m', '1h30m') (required for schedule)"`
TaskID string `json:"task_id,omitempty" jsonschema:"Task ID (required for cancel)"`
Global bool `json:"global,omitempty" jsonschema:"For list/tasks: include sessions/tasks from all directories (default: false)"`
}
SessionInput defines input for the session tool.
type SessionOutput ¶ added in v0.7.0
type SessionOutput struct {
// For list
Sessions []SessionEntry `json:"sessions,omitempty"`
Count int `json:"count"`
// For get
Session *SessionEntry `json:"session,omitempty"`
// For tasks
Tasks []TaskEntry `json:"tasks,omitempty"`
// For send/schedule
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
TaskID string `json:"task_id,omitempty"`
// For schedule
DeliverAt *time.Time `json:"deliver_at,omitempty"`
// Directory filtering info
Directory string `json:"directory,omitempty"`
Global bool `json:"global,omitempty"`
}
SessionOutput defines output for the session tool.
type SnapshotInput ¶
type SnapshotInput struct {
Action string `json:"action" jsonschema:"Action: baseline, compare, list, delete, get"`
Name string `json:"name,omitempty" jsonschema:"Baseline name (required for baseline/compare/delete/get)"`
Baseline string `json:"baseline,omitempty" jsonschema:"Baseline name to compare against (for compare action)"`
Pages []snapshot.PageCapture `json:"pages,omitempty" jsonschema:"Pages to capture (array of {url viewport screenshot_data})"`
DiffThreshold float64 `json:"diff_threshold,omitempty" jsonschema:"Diff sensitivity threshold 0.0-1.0 (default: 0.01)"`
}
SnapshotInput defines input for the snapshot tool
type SnapshotOutput ¶
type SnapshotOutput struct {
Success bool `json:"success"`
Message string `json:"message"`
Data string `json:"data,omitempty"`
}
SnapshotOutput defines output for the snapshot tool
type StoreEntryOutput ¶ added in v0.8.0
type StoreEntryOutput struct {
Value interface{} `json:"value"`
Type string `json:"type"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Metadata map[string]any `json:"metadata,omitempty"`
}
StoreEntryOutput represents a single store entry.
type StoreInput ¶ added in v0.8.0
type StoreInput struct {
Action string `json:"action" jsonschema:"Action: get, set, delete, list, clear, get_all"`
Scope string `json:"scope,omitempty" jsonschema:"Scope: global, folder, page"`
ScopeKey string `json:"scope_key,omitempty" jsonschema:"Scope key (URL for page, path for folder, empty for global)"`
Key string `json:"key,omitempty" jsonschema:"Key (required for get, set, delete)"`
Value interface{} `json:"value,omitempty" jsonschema:"Value to store (required for set)"`
Metadata map[string]any `json:"metadata,omitempty" jsonschema:"Optional metadata"`
}
StoreInput represents input for the store tool.
type StoreOutput ¶ added in v0.8.0
type StoreOutput struct {
Success bool `json:"success"`
Entry *StoreEntryOutput `json:"entry,omitempty"`
Entries map[string]*StoreEntryOutput `json:"entries,omitempty"`
Keys []string `json:"keys,omitempty"`
Count int `json:"count"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
}
StoreOutput represents output from the store tool.
type TaskEntry ¶ added in v0.7.0
type TaskEntry struct {
ID string `json:"id"`
SessionCode string `json:"session_code"`
Message string `json:"message"`
DeliverAt time.Time `json:"deliver_at"`
CreatedAt time.Time `json:"created_at"`
ProjectPath string `json:"project_path,omitempty"`
Status string `json:"status"`
Attempts int `json:"attempts,omitempty"`
LastError string `json:"last_error,omitempty"`
}
TaskEntry represents a scheduled task in the list.
type TunnelEntry ¶
type TunnelEntry struct {
ID string `json:"id,omitempty"`
Provider string `json:"provider"`
State string `json:"state"`
PublicURL string `json:"public_url,omitempty"`
LocalAddr string `json:"local_addr"`
Path string `json:"path,omitempty"`
Error string `json:"error,omitempty"`
}
TunnelEntry represents a tunnel in a list response.
type TunnelInput ¶
type TunnelInput struct {
Action string `json:"action" jsonschema:"Action: start, stop, status, list"`
ID string `json:"id,omitempty" jsonschema:"Tunnel ID (required for start/stop/status)"`
Provider string `json:"provider,omitempty" jsonschema:"Tunnel provider: 'cloudflare' or 'ngrok' (required for start)"`
LocalPort int `json:"local_port,omitempty" jsonschema:"Local port to tunnel (required for start)"`
LocalHost string `json:"local_host,omitempty" jsonschema:"Local host (default: localhost)"`
BinaryPath string `json:"binary_path,omitempty" jsonschema:"Optional path to tunnel binary"`
ProxyID string `json:"proxy_id,omitempty" jsonschema:"Optional proxy ID to auto-configure with the tunnel's public URL"`
Global bool `json:"global,omitempty" jsonschema:"For list: include tunnels from all directories (default: false)"`
}
TunnelInput represents input for the tunnel tool.
type TunnelOutput ¶
type TunnelOutput struct {
ID string `json:"id,omitempty"`
Provider string `json:"provider,omitempty"`
State string `json:"state,omitempty"`
PublicURL string `json:"public_url,omitempty"`
LocalAddr string `json:"local_addr,omitempty"`
Error string `json:"error,omitempty"`
Success bool `json:"success,omitempty"`
Message string `json:"message,omitempty"`
Count int `json:"count"`
Tunnels []TunnelEntry `json:"tunnels,omitempty"`
}
TunnelOutput represents output from the tunnel tool.
type TunnelStatus ¶
TunnelStatus represents tunnel status information.
type ViewportInput ¶ added in v0.12.0
type ViewportInput struct {
Name string `json:"name" jsonschema:"Viewport name (e.g., 'mobile', 'tablet', 'desktop')"`
Width int `json:"width" jsonschema:"Viewport width in pixels"`
Height int `json:"height" jsonschema:"Viewport height in pixels"`
}
ViewportInput defines a viewport for testing.
type WatchInput ¶ added in v0.12.36
type WatchInput struct {
Target string `json:"target,omitempty" jsonschema:"What to watch: errors, interactions, process, or all (default: all)"`
ProxyID string `json:"proxy_id,omitempty" jsonschema:"Proxy ID to filter (used with errors and interactions targets)"`
ProcessID string `json:"process_id,omitempty" jsonschema:"Process ID to filter (required for process target)"`
}
WatchInput is the input for the watch tool.
type WatchOutput ¶ added in v0.12.36
WatchOutput is the output for the watch tool.
Source Files
¶
- apidocs.go
- apidocs_gen.go
- automation_tools.go
- browser_tools.go
- channel_capability.go
- channel_reply.go
- channel_sink.go
- converters.go
- currentpage_tools.go
- daemon_currentpage.go
- daemon_management.go
- daemon_proc.go
- daemon_proxy.go
- daemon_tools.go
- doc.go
- dual_backend.go
- exec_hints.go
- get_errors.go
- get_errors_converters.go
- lenient.go
- pagination.go
- process.go
- project.go
- proxy_description.go
- proxy_log_tools.go
- proxy_tools.go
- responsive_audit.go
- session_tools.go
- snapshot.go
- store_tools.go
- toolhelpers.go
- tunnel_tools.go
- validate.go
- watch.go