Help us shape the future of Go! Take the 2026 Go Developer Survey

mcpapps

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mcpapps carries request-scoped host-only MCP results separately from model-safe tool text. No result enters model messages or shared agent state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Active

func Active(ctx context.Context) bool

func Activity

func Activity(messageID string, app AppBinding, result, args json.RawMessage) (json.RawMessage, error)

func EmitActivity

func EmitActivity(ctx context.Context, app AppBinding, result, args json.RawMessage) error

func HasActivityEmitter

func HasActivityEmitter(ctx context.Context) bool

func Record

func Record(ctx context.Context, server, tool, nativeOperationID string, result *mcpschema.CallToolResult) error

Record is called at the canonical registry's actual MCP response boundary. The exact selected server/method must match this one host request.

func RecordCompletion

func RecordCompletion(ctx context.Context, principal, conversation, turn string)

RecordCompletion follows successful full native guest-turn finalization. It also requires that the canonical capture belongs to this exact request and already has the same durably committed effect/result.

func Scope

func Scope(ctx context.Context) (string, string, bool)

Scope is the exact native server/tool selected by the already authorized host binding. It is never reconstructed from a lossy provider tool alias.

func ServerHash

func ServerHash(transport, endpoint string) (string, error)

func TurnID

func TurnID(ctx context.Context) string

func Visible

func Visible(meta map[string]interface{}, audience string) bool

Visible implements the stable Apps _meta.ui.visibility contract. Missing visibility defaults to model and app. Malformed/unknown audiences fail closed.

func WithActivityEmitter

func WithActivityEmitter(ctx context.Context, emit ActivityEmitter) context.Context

func WithRecorder

func WithRecorder(ctx context.Context, recorder func(json.RawMessage, string) error) context.Context

func WithTurnID

func WithTurnID(ctx context.Context, turnID string) context.Context

Types

type AppBinding

type AppBinding struct {
	AppInstanceID  string `json:"appInstanceId"`
	PublicServerID string `json:"publicServerId"`
	Version        string `json:"version"`
	ThreadID       string `json:"threadId"`
	NativeTurnID   string `json:"nativeTurnId,omitempty"`
	InvocationID   string `json:"invocationId,omitempty"`
	ServerID       string `json:"nativeServerId"`
	ServerHash     string `json:"serverHash"`
	ResourceURI    string `json:"resourceUri"`
}

type Capture

type Capture struct {
	Server, Tool, OperationID string
	NativeOperationID         string
	Result                    json.RawMessage
	// contains filtered or unexported fields
}

func WithCapture

func WithCapture(ctx context.Context, server, tool, operationID string) (context.Context, *Capture)

func (*Capture) Snapshot

func (c *Capture) Snapshot() (json.RawMessage, string)

type CompletionReceipt

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

CompletionReceipt is private to one server-owned proxy invocation. It is neither serialized nor recovered from a journal or guest-supplied metadata.

func WithCompletionReceipt

func WithCompletionReceipt(ctx context.Context, principal, conversation, turn, operation, server, tool string) (context.Context, *CompletionReceipt)

WithCompletionReceipt is called only for a fresh, non-resumed host request. Each invocation gets a new receipt; identity and completion are never cached across requests or installed by a wire field.

func (*CompletionReceipt) Matches

func (r *CompletionReceipt) Matches(principal, conversation, turn, operation, native, status string, result json.RawMessage) bool

Matches permits reuse only for the exact successful completion in this same live invocation. Failed, missing, changed or recovered receipts fall through to the existing full finalizer.

func (*CompletionReceipt) RecordDurable

func (r *CompletionReceipt) RecordDurable(native string, result json.RawMessage)

RecordDurable is called by the trusted host recorder only after its exact native effect and full result were successfully committed to the journal.

Jump to

Keyboard shortcuts

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