mcpcontract

package
v0.0.1-dev.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 6 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 (
	Version   = 1
	Marker    = "holon-generated-apps-v1"
	MediaType = "application/vnd.holon.mcp-contract.v1+json"
)

Variables

This section is empty.

Functions

func Managed

func Managed(directory string) bool

Managed reports whether directory is a package Holon generated before the public runtimes: the legacy Python holon/ copy or a Go holon/ client package, both marked in package.json.

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"`
}

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 Expectation

type Expectation struct {
	Identity Identity `json:"identity"`
	Contract Contract `json:"contract"`
}

type Identity

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

type Metadata

type Metadata struct {
	Version  int                    `json:"version"`
	Identity Identity               `json:"identity"`
	Contract *Contract              `json:"contract,omitempty"`
	Requires map[string]Expectation `json:"requires,omitempty"`
}

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