mcpcontract

package
v0.3.6 Latest Latest
Warning

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

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

Documentation

Overview

Package mcpcontract owns Scenery's provider-neutral MCP capability manifest and the wire values exchanged across the private gateway dispatch boundary.

Index

Constants

View Source
const (
	ManifestKind = "scenery.mcp-capability-manifest"

	ProtocolVersion    = "2025-11-25"
	StatusToolName     = "scenery_execution_status"
	CancelToolName     = "scenery_execution_cancel"
	ToolNamePattern    = `^[a-z][a-z0-9_]{0,127}$`
	MaximumInputBytes  = 16 << 20
	MaximumResultBytes = 16 << 20
)

Variables

View Source
var ManifestSchemaRevision = string(spec.SchemaRevision(manifestSchemaDescriptor))

Functions

func Digest

func Digest(manifest Manifest) (string, error)

func MarshalCanonical

func MarshalCanonical(manifest Manifest) ([]byte, error)

func MarshalOutcome

func MarshalOutcome(outcome ToolOutcome) ([]byte, error)

Types

type Approval

type Approval string
const (
	ApprovalNever  Approval = "never"
	ApprovalAlways Approval = "always"
)

type Auth

type Auth struct {
	Authentication string `json:"authentication"`
	Authorization  string `json:"authorization"`
}

type CancelResult

type CancelResult struct {
	ExecutionID string `json:"execution_id"`
	State       string `json:"state"`
}

type Capability

type Capability struct {
	ID                   string          `json:"id"`
	Name                 string          `json:"name"`
	Title                string          `json:"title,omitempty"`
	Description          string          `json:"description,omitempty"`
	InputSchema          json.RawMessage `json:"input_schema"`
	OutputSchema         json.RawMessage `json:"output_schema"`
	OperationAddress     string          `json:"operation_address"`
	ExecutionAddress     string          `json:"execution_address"`
	Origin               Origin          `json:"origin"`
	Auth                 Auth            `json:"auth"`
	Limits               Limits          `json:"limits"`
	Effect               Effect          `json:"effect"`
	Approval             Approval        `json:"approval"`
	Durable              bool            `json:"durable"`
	AllowSensitiveOutput bool            `json:"allow_sensitive_output"`
}

type Connection

type Connection struct {
	Address   string   `json:"address"`
	Namespace string   `json:"namespace"`
	Required  bool     `json:"required"`
	Allow     []string `json:"allow,omitempty"`
	Block     []string `json:"block,omitempty"`
}

Connection identifies a federated capability source without carrying its URL, authentication material, or any provider-specific configuration.

type DeclaredProblem

type DeclaredProblem struct {
	Code    string          `json:"code"`
	Message string          `json:"message"`
	Path    string          `json:"path,omitempty"`
	Details json.RawMessage `json:"details,omitempty"`
}

type DurableReceipt

type DurableReceipt struct {
	DurableIdentity  string `json:"durable_identity"`
	ExecutionID      string `json:"execution_id"`
	AcceptedRevision string `json:"accepted_revision"`
}

type Effect

type Effect struct {
	ReadOnly    bool `json:"read_only"`
	Destructive bool `json:"destructive"`
	Idempotent  bool `json:"idempotent"`
	OpenWorld   bool `json:"open_world"`
}

type ExecutionStatus

type ExecutionStatus struct {
	ExecutionID string          `json:"execution_id"`
	State       string          `json:"state"`
	Outcome     json.RawMessage `json:"outcome,omitempty"`
}

type Limits

type Limits struct {
	MaxInputBytes  int `json:"max_input_bytes"`
	MaxResultBytes int `json:"max_result_bytes"`
}

type Manifest

type Manifest struct {
	Kind                   string       `json:"kind"`
	SchemaRevision         string       `json:"schema_revision"`
	ProtocolVersion        string       `json:"protocol_version"`
	SourceRevision         string       `json:"source_revision,omitempty"`
	ContractRevision       string       `json:"contract_revision"`
	ImplementationRevision string       `json:"implementation_revision,omitempty"`
	Capabilities           []Capability `json:"capabilities"`
	Connections            []Connection `json:"connections"`
}

func Parse

func Parse(data []byte) (Manifest, error)

func (Manifest) Validate

func (manifest Manifest) Validate() error

type Origin

type Origin struct {
	Kind      string `json:"kind"`
	Address   string `json:"address"`
	Namespace string `json:"namespace,omitempty"`
}

type ToolCallContext

type ToolCallContext struct {
	Principal          string            `json:"principal"`
	AssistantAddress   string            `json:"assistant_address"`
	ConversationDigest string            `json:"conversation_digest"`
	CapabilityRevision string            `json:"capability_revision"`
	RequestID          string            `json:"request_id"`
	TraceContext       map[string]string `json:"trace_context,omitempty"`
	IdempotencyKey     string            `json:"idempotency_key,omitempty"`
}

ToolCallContext is derived from a short-lived private assertion. Principal is a Scenery identity, never an application bearer token or external secret.

type ToolDispatcher

type ToolDispatcher interface {
	CallTool(context.Context, ToolCallContext, string, json.RawMessage) (ToolOutcome, error)
}

type ToolOutcome

type ToolOutcome struct {
	Outcome string          `json:"outcome"`
	Value   json.RawMessage `json:"value,omitempty"`
	Problem json.RawMessage `json:"problem,omitempty"`
	Receipt *DurableReceipt `json:"receipt,omitempty"`
}

Jump to

Keyboard shortcuts

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