webmcp

package
v0.157.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package webmcp provides the Chrome DevTools Protocol commands, types, and events for the WebMCP domain.

Generated by the pdlgen command.

Index

Constants

View Source
const (
	CommandEnable           = "WebMCP.enable"
	CommandDisable          = "WebMCP.disable"
	CommandInvokeTool       = "WebMCP.invokeTool"
	CommandCancelInvocation = "WebMCP.cancelInvocation"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	ReadOnly         bool `json:"readOnly"`         // A hint indicating that the tool does not modify any state.
	UntrustedContent bool `json:"untrustedContent"` // A hint indicating that the tool output may contain untrusted content, ex: UGC, 3rd party data.
	Consequential    bool `json:"consequential"`    // A hint indicating that executing the tool will result in consequential actions, ex: booking a flight, transferring money.
	Debugging        bool `json:"debugging"`        // If true, indicates that the tool is intended for debugging and developer tooling rather than end-user interactions.
	Autosubmit       bool `json:"autosubmit"`       // If the declarative tool was declared with the autosubmit attribute.
}

Annotation tool annotations.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#type-Annotation

type CancelInvocationParams

type CancelInvocationParams struct {
	InvocationID string `json:"invocationId"` // Invocation identifier to cancel.
}

CancelInvocationParams cancels a pending tool invocation.

func CancelInvocation

func CancelInvocation(invocationID string) *CancelInvocationParams

CancelInvocation cancels a pending tool invocation.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#method-cancelInvocation

parameters:

invocationID - Invocation identifier to cancel.

func (*CancelInvocationParams) Do

func (p *CancelInvocationParams) Do(ctx context.Context) (err error)

Do executes WebMCP.cancelInvocation against the provided context.

type DisableParams

type DisableParams struct{}

DisableParams disables the WebMCP domain.

func Disable

func Disable() *DisableParams

Disable disables the WebMCP domain.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#method-disable

func (*DisableParams) Do

func (p *DisableParams) Do(ctx context.Context) (err error)

Do executes WebMCP.disable against the provided context.

type EnableParams

type EnableParams struct{}

EnableParams enables the WebMCP domain, allowing events to be sent. Enabling the domain will trigger a toolsAdded event for all currently registered tools.

func Enable

func Enable() *EnableParams

Enable enables the WebMCP domain, allowing events to be sent. Enabling the domain will trigger a toolsAdded event for all currently registered tools.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#method-enable

func (*EnableParams) Do

func (p *EnableParams) Do(ctx context.Context) (err error)

Do executes WebMCP.enable against the provided context.

type EventToolInvoked

type EventToolInvoked struct {
	ToolName     string      `json:"toolName"`     // Name of the tool to invoke.
	FrameID      cdp.FrameID `json:"frameId"`      // Frame id
	InvocationID string      `json:"invocationId"` // Invocation identifier.
	Input        string      `json:"input"`        // The input parameters used for the invocation.
}

EventToolInvoked event fired when a tool invocation starts.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#event-toolInvoked

type EventToolResponded

type EventToolResponded struct {
	InvocationID string                `json:"invocationId"`                 // Invocation identifier.
	Status       InvocationStatus      `json:"status"`                       // Status of the invocation.
	Output       jsontext.Value        `json:"output,omitempty,omitzero"`    // Output or error delivered as delivered to the agent. Missing if status is anything other than Completed. Note: The output is untrusted and poses a prompt injection risk. Clients should treat this as potentially malicious user input.
	ErrorText    string                `json:"errorText,omitempty,omitzero"` // Error text for protocol users.
	Exception    *runtime.RemoteObject `json:"exception,omitempty,omitzero"` // The exception object, if the javascript tool threw an error>
}

EventToolResponded event fired when a tool invocation completes or fails.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#event-toolResponded

type EventToolsAdded

type EventToolsAdded struct {
	Tools []*Tool `json:"tools"` // Array of tools that were added.
}

EventToolsAdded event fired when new tools are added.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#event-toolsAdded

type EventToolsRemoved

type EventToolsRemoved struct {
	Tools []*RemovedTool `json:"tools"` // Array of tools that were removed.
}

EventToolsRemoved event fired when tools are removed.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#event-toolsRemoved

type InvocationStatus

type InvocationStatus string

InvocationStatus represents the status of a tool invocation.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#type-InvocationStatus

const (
	InvocationStatusCompleted InvocationStatus = "Completed"
	InvocationStatusCanceled  InvocationStatus = "Canceled"
	InvocationStatusError     InvocationStatus = "Error"
)

InvocationStatus values.

func (InvocationStatus) String

func (t InvocationStatus) String() string

String returns the InvocationStatus as string value.

type InvokeToolParams

type InvokeToolParams struct {
	FrameID  cdp.FrameID    `json:"frameId"`  // Frame in which to invoke the tool.
	ToolName string         `json:"toolName"` // Name of the tool to invoke.
	Input    jsontext.Value `json:"input"`
}

InvokeToolParams invokes a registered tool.

func InvokeTool

func InvokeTool(frameID cdp.FrameID, toolName string, input jsontext.Value) *InvokeToolParams

InvokeTool invokes a registered tool.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#method-invokeTool

parameters:

frameID - Frame in which to invoke the tool.
toolName - Name of the tool to invoke.
input - Input parameters for the tool, matching the tool's inputSchema.

func (*InvokeToolParams) Do

func (p *InvokeToolParams) Do(ctx context.Context) (invocationID string, err error)

Do executes WebMCP.invokeTool against the provided context.

returns:

invocationID - Unique identifier for this invocation. Response is sent before tool events.

type InvokeToolReturns

type InvokeToolReturns struct {
	InvocationID string `json:"invocationId,omitempty,omitzero"` // Unique identifier for this invocation. Response is sent before tool events.
}

InvokeToolReturns return values.

type RemovedTool

type RemovedTool struct {
	Name    string      `json:"name"`    // Tool name.
	FrameID cdp.FrameID `json:"frameId"` // Frame identifier associated with the tool registration.
}

RemovedTool definition of a tool that was removed.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#type-RemovedTool

type Tool

type Tool struct {
	Name          string              `json:"name"`        // Tool name.
	Description   string              `json:"description"` // Tool description.
	InputSchema   jsontext.Value      `json:"inputSchema,omitempty,omitzero"`
	Annotations   *Annotation         `json:"annotations,omitempty,omitzero"`   // Optional annotations for the tool.
	FrameID       cdp.FrameID         `json:"frameId"`                          // Frame identifier associated with the tool registration.
	BackendNodeID cdp.BackendNodeID   `json:"backendNodeId,omitempty,omitzero"` // Optional node ID for declarative tools.
	StackTrace    *runtime.StackTrace `json:"stackTrace,omitempty,omitzero"`    // The stack trace at the time of the registration.
}

Tool definition of a tool that can be invoked.

See: https://chromedevtools.github.io/devtools-protocol/tot/WebMCP#type-Tool

Jump to

Keyboard shortcuts

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