Documentation
¶
Index ¶
- Variables
- 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 RegisterDaemonManagementTool(server *mcp.Server, dt *DaemonTools)
- func RegisterDaemonTools(server *mcp.Server, dt *DaemonTools)
- func RegisterProcessTools(server *mcp.Server, pm *process.ProcessManager)
- func RegisterProjectTools(server *mcp.Server)
- func RegisterProxyTools(server *mcp.Server, 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)
- type APICategory
- type APIFunction
- type AutomationEntry
- type AutomationInput
- type AutomationOutput
- type BrowserEntry
- type BrowserInput
- type BrowserOutput
- 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) Close() 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)
- type DetectInput
- type DetectOutput
- type ErrorSummary
- type LogEntryOutput
- type LogStatsOutput
- type PageSessionOutput
- type PageSummaryOutput
- type ProcEntry
- type ProcInput
- type ProcOutput
- type ProcessInfo
- type ProxyEntry
- type ProxyInfo
- type ProxyInput
- type ProxyLogInput
- type ProxyLogOutput
- type ProxyLogSummary
- type ProxyOutput
- 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
Constants ¶
This section is empty.
Variables ¶
var DevToolAPIDocs = struct { Categories []APICategory Functions []APIFunction }{ 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: []APIFunction{ { 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: "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: "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: "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: "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: "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: "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: "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: "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: string[] - Specific properties to get (default: common properties)"}, Returns: "{property: value, ...}", Example: `__devtool.getComputed("#header", ["display", "position", "z-index"])`, }, { 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: "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: "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: "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: "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: "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", "options: {maxDepth?, filter?} - 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: "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: "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")`, }, { 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: "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: "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: "findOffscreen", Category: "layout", Description: "Find elements positioned outside the viewport", Signature: "findOffscreen()", Parameters: []string{}, Returns: "[{element, position, distance}, ...]", Example: `__devtool.findOffscreen()`, }, { 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", "options: {color?, label?, duration?} - 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: "clearAllOverlays", Category: "overlay", Description: "Remove all highlight overlays", Signature: "clearAllOverlays()", Parameters: []string{}, Returns: "void", Example: `__devtool.clearAllOverlays()`, }, { 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: "ask", Category: "interactive", Description: "Display a prompt dialog and wait for user input", Signature: "ask(question, options?)", Parameters: []string{"question: string - Question to display", "options: {choices?, default?} - 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: "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: "captureStyles", Category: "capture", Description: "Capture all stylesheets and computed styles", Signature: "captureStyles()", Parameters: []string{}, Returns: "{stylesheets: [...], inlineStyles: [...]}", Example: `__devtool.captureStyles()`, }, { 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: "captureNetwork", Category: "capture", Description: "Get performance timing and resource information", Signature: "captureNetwork()", Parameters: []string{}, Returns: "{timing, resources: [...], paintTiming}", Example: `__devtool.captureNetwork()`, }, { 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: "getTabOrder", Category: "accessibility", Description: "Get focusable elements in tab order", Signature: "getTabOrder()", Parameters: []string{}, Returns: "[{element, tabIndex, natural}, ...]", Example: `__devtool.getTabOrder()`, }, { 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: "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: "auditDOMComplexity", Category: "audit", Description: "Analyze DOM complexity and depth", Signature: "auditDOMComplexity()", Parameters: []string{}, Returns: "{elementCount, maxDepth, avgDepth, deepElements, widest}", Example: `__devtool.auditDOMComplexity()`, }, { Name: "auditCSS", Category: "audit", Description: "Analyze CSS usage and potential issues", Signature: "auditCSS()", Parameters: []string{}, Returns: "{unusedRules, duplicates, specificity, importantCount}", Example: `__devtool.auditCSS()`, }, { Name: "auditSecurity", Category: "audit", Description: "Check for common security issues", Signature: "auditSecurity()", Parameters: []string{}, Returns: "{issues: [...], summary}", Example: `__devtool.auditSecurity()`, }, { Name: "auditPageQuality", Category: "audit", Description: "Comprehensive page quality audit", Signature: "auditPageQuality()", Parameters: []string{}, Returns: "{dom, css, accessibility, security, performance}", Example: `__devtool.auditPageQuality()`, }, { 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.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.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: "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.clear", Category: "interactions", Description: "Clear interaction history", Signature: "interactions.clear()", Parameters: []string{}, Returns: "void", Example: `__devtool.interactions.clear()`, }, { 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.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.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.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.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.clear", Category: "mutations", Description: "Clear mutation history", Signature: "mutations.clear()", Parameters: []string{}, Returns: "void", Example: `__devtool.mutations.clear()`, }, { 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: "indicator.show", Category: "indicator", Description: "Show the floating indicator", Signature: "indicator.show()", Parameters: []string{}, Returns: "void", Example: `__devtool.indicator.show()`, }, { Name: "indicator.hide", Category: "indicator", Description: "Hide the floating indicator", Signature: "indicator.hide()", Parameters: []string{}, Returns: "void", Example: `__devtool.indicator.hide()`, }, { 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: "indicator.destroy", Category: "indicator", Description: "Remove the floating indicator completely", Signature: "indicator.destroy()", Parameters: []string{}, Returns: "void", Example: `__devtool.indicator.destroy()`, }, { Name: "sketch.open", Category: "sketch", Description: "Open sketch mode for wireframing", Signature: "sketch.open()", Parameters: []string{}, Returns: "void", Example: `__devtool.sketch.open()`, }, { Name: "sketch.close", Category: "sketch", Description: "Close sketch mode", Signature: "sketch.close()", Parameters: []string{}, Returns: "void", Example: `__devtool.sketch.close()`, }, { Name: "sketch.toggle", Category: "sketch", Description: "Toggle sketch mode on/off", Signature: "sketch.toggle()", Parameters: []string{}, Returns: "void", Example: `__devtool.sketch.toggle()`, }, { 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.save", Category: "sketch", Description: "Save sketch and send to proxy server", Signature: "sketch.save()", Parameters: []string{}, Returns: "void", Example: `__devtool.sketch.save()`, }, { 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.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.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.undo", Category: "sketch", Description: "Undo last sketch action", Signature: "sketch.undo()", Parameters: []string{}, Returns: "void", Example: `__devtool.sketch.undo()`, }, { Name: "sketch.redo", Category: "sketch", Description: "Redo previously undone action", Signature: "sketch.redo()", Parameters: []string{}, Returns: "void", Example: `__devtool.sketch.redo()`, }, { Name: "sketch.clear", Category: "sketch", Description: "Clear all sketch elements", Signature: "sketch.clear()", Parameters: []string{}, Returns: "void", Example: `__devtool.sketch.clear()`, }, { 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.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.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.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: "isConnected", Category: "connection", Description: "Check if WebSocket is connected to proxy server", Signature: "isConnected()", Parameters: []string{}, Returns: "boolean", Example: `if (__devtool.isConnected()) { ... }`, }, { 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: "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: "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()`, }, }, }
DevToolAPIDocs contains the full API documentation.
Functions ¶
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 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 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 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.
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 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,omitempty"`
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,omitempty"`
Browsers []BrowserEntry `json:"browsers,omitempty"`
}
BrowserOutput represents output from the browser tool.
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,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"`
}
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) Close ¶
func (dt *DaemonTools) Close() error
Close closes the daemon client connection.
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).
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 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 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 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)
MarshalJSON custom marshaler for proper JSON serialization
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 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"`
}
ProcEntry is a process in the list.
type ProcInput ¶
type ProcInput struct {
Action string `json:"action" jsonschema:"Action: status, output, stop, restart, list, cleanup_port, autorestart"`
ProcessID string `json:"process_id,omitempty" jsonschema:"Process ID (required for status/output/stop/restart/autorestart)"`
// 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)"`
// 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"`
// For output
Output string `json:"output,omitempty"`
Lines int `json:"lines,omitempty"`
Truncated bool `json:"truncated,omitempty"`
// For list
Count int `json:"count,omitempty"`
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 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"`
}
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 */
PublicURL string `` /* 159-byte string literal not displayed */
VerifyTLS bool `` /* 160-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 */
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, summary, clear, stats (default: query)"`
Types []string `json:"types,omitempty" jsonschema:"Filter by type: http, error, performance, diagnostic"`
Methods []string `json:"methods,omitempty" jsonschema:"Filter by HTTP method: GET, POST, etc."`
URLPattern string `json:"url_pattern,omitempty" jsonschema:"URL substring to match"`
StatusCodes []int `json:"status_codes,omitempty" jsonschema:"Filter by HTTP status code"`
Since string `json:"since,omitempty" jsonschema:"Start time (RFC3339 or duration like '5m')"`
Until string `json:"until,omitempty" jsonschema:"End time (RFC3339)"`
Limit int `json:"limit,omitempty" jsonschema:"Maximum results (default: 100)"`
Detail []string `` /* 151-byte string literal not displayed */
Raw bool `json:"raw,omitempty" jsonschema:"For query: return full raw data dumps instead of compact format (default: false)"`
ErrorsOnly bool `` /* 127-byte string literal not displayed */
DiagnosticLevels []string `json:"diagnostic_levels,omitempty" jsonschema:"Filter diagnostics by level: info, warning, error"`
}
ProxyLogInput defines input for the proxylog tool.
type ProxyLogOutput ¶
type ProxyLogOutput struct {
// For query
Entries []LogEntryOutput `json:"entries,omitempty"`
Count int `json:"count,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
// For list
Count int `json:"count,omitempty"`
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 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 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,omitempty"`
// 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,omitempty"`
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,omitempty"`
Tunnels []TunnelEntry `json:"tunnels,omitempty"`
}
TunnelOutput represents output from the tunnel tool.
type TunnelStatus ¶
TunnelStatus represents tunnel status information.