mcpcontract

package
v0.0.1-dev.27 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mcpcontract holds the typed-contract wire format Holon publishes in image metadata and helpers for generated files. Comparison and generation live in mcptype.

Index

Constants

View Source
const (
	Marker           = "holon-generated-apps-v1"
	DigestAnnotation = "sh.holon.contract.digest"
	MediaType        = "application/vnd.holon.mcp-contract.v1+json"
)

Variables

This section is empty.

Functions

func StableTime

func StableTime(data []byte) time.Time

StableTime returns the mtime Holon gives a file it writes into a build context. BuildKit's incremental sync resends a file only when its size or mtime changed, so the time must be fixed for unchanged content and differ for changed content of the same size. It is 1980 (the zip epoch) plus a content-derived offset of under 105 days.

func WriteStable

func WriteStable(path string, data []byte, mode os.FileMode) error

WriteStable writes data to path with mode and StableTime(data) as its mtime.

Types

type Contract

type Contract struct {
	Tools     []Tool     `json:"tools"`
	Resources []Resource `json:"resources,omitempty"`
	Events    []Event    `json:"events,omitempty"`
}

func (Contract) MarshalJSON

func (c Contract) MarshalJSON() ([]byte, error)

MarshalJSON writes "tools" as an array even when there are none, as the v1 contract document requires.

type Event

type Event struct {
	Name    string          `json:"name"`
	Input   json.RawMessage `json:"inputSchema"`
	Payload json.RawMessage `json:"payloadSchema"`
}

Event is an event type a server lists with events/list, from MCP Events, the draft extension of the Triggers & Events Working Group: the schemas of a subscription's arguments and of an occurrence's data.

type Identity

type Identity struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type Metadata

type Metadata struct {
	Identity Identity          `json:"identity"`
	Schema   *Contract         `json:"schema,omitempty"`
	Requires map[string]string `json:"requires,omitempty"`
}

Metadata is the contract document stored as an OCI blob. Requires pins each dependency to its exact document bytes in the consumer's repository.

type Resource

type Resource struct {
	URI    string          `json:"uri"`
	Output json.RawMessage `json:"outputSchema"`
}

type Tool

type Tool struct {
	Name   string          `json:"name"`
	Input  json.RawMessage `json:"inputSchema"`
	Output json.RawMessage `json:"outputSchema,omitempty"`
}

Jump to

Keyboard shortcuts

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