appproto

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package appproto defines the local contract-of-record browser host/guest postMessage envelopes for the MCP UI extension layer.

These message types are intentionally distinct from MCP JSON-RPC method names between MCP clients and MCP servers.

Index

Constants

View Source
const (
	MethodToolsCall        = "mcpui:tools-call"
	MethodMessage          = "mcpui:message"
	MethodOpenLink         = "mcpui:open-link"
	MethodHostReady        = "mcpui:host-ready"
	MethodToolInput        = "mcpui:tool-input"
	MethodToolInputPartial = "mcpui:tool-input-partial"
	MethodToolResult       = "mcpui:tool-result"
	MethodTeardown         = "mcpui:teardown"
	MethodSizeChanged      = "mcpui:size-changed"
)
View Source
const Version = "1.0.0"

Version is the current local appproto envelope version.

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope[T any] struct {
	Version string `json:"version"`
	Method  string `json:"method"`
	Params  T      `json:"params"`
}

func NewEnvelope

func NewEnvelope[T any](method string, params T) Envelope[T]

type HostReadyParams

type HostReadyParams struct {
	WindowID        string   `json:"windowId"`
	ResourceURI     string   `json:"resourceUri"`
	AllowedTools    []string `json:"allowedTools,omitempty"`
	ProtocolVersion string   `json:"protocolVersion"`
}

type MessageParams

type MessageParams struct {
	WindowID    string                 `json:"windowId"`
	ResourceURI string                 `json:"resourceUri"`
	Content     string                 `json:"content"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

type OpenLinkParams

type OpenLinkParams struct {
	WindowID    string `json:"windowId"`
	ResourceURI string `json:"resourceUri"`
	URL         string `json:"url"`
}

type SizeChangedParams

type SizeChangedParams struct {
	WindowID    string `json:"windowId"`
	ResourceURI string `json:"resourceUri"`
	Width       int    `json:"width,omitempty"`
	Height      int    `json:"height,omitempty"`
}

type TeardownParams

type TeardownParams struct {
	WindowID    string `json:"windowId"`
	ResourceURI string `json:"resourceUri"`
	Reason      string `json:"reason,omitempty"`
}

type ToolInputParams

type ToolInputParams struct {
	WindowID        string                 `json:"windowId"`
	ResourceURI     string                 `json:"resourceUri"`
	ToolName        string                 `json:"toolName"`
	ToolInput       map[string]interface{} `json:"toolInput,omitempty"`
	ProtocolVersion string                 `json:"protocolVersion"`
}

type ToolInputPartialParams

type ToolInputPartialParams struct {
	WindowID        string                 `json:"windowId"`
	ResourceURI     string                 `json:"resourceUri"`
	ToolName        string                 `json:"toolName"`
	ToolInput       map[string]interface{} `json:"toolInput,omitempty"`
	ProtocolVersion string                 `json:"protocolVersion"`
}

type ToolResultParams

type ToolResultParams struct {
	WindowID          string                 `json:"windowId"`
	ResourceURI       string                 `json:"resourceUri"`
	ToolName          string                 `json:"toolName"`
	Content           interface{}            `json:"content,omitempty"`
	StructuredContent map[string]interface{} `json:"structuredContent,omitempty"`
	Meta              map[string]interface{} `json:"_meta,omitempty"`
	ProtocolVersion   string                 `json:"protocolVersion"`
}

type ToolsCallParams

type ToolsCallParams struct {
	WindowID    string                 `json:"windowId"`
	ResourceURI string                 `json:"resourceUri"`
	Name        string                 `json:"name"`
	Arguments   map[string]interface{} `json:"arguments,omitempty"`
}

Jump to

Keyboard shortcuts

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