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

spec

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func At

func At(n *yaml.Node, path, message string) error

func Comment

func Comment(text string) string

func Keys

func Keys[V any](m map[string]V) []string

func Required

func Required(s *Schema, name string) bool

Types

type Annotations

type Annotations struct {
	ReadOnlyHint    bool   `yaml:"readOnlyHint" json:"readOnlyHint"`
	DestructiveHint *bool  `yaml:"destructiveHint" json:"destructiveHint,omitempty"`
	IdempotentHint  bool   `yaml:"idempotentHint" json:"idempotentHint"`
	OpenWorldHint   *bool  `yaml:"openWorldHint" json:"openWorldHint,omitempty"`
	Title           string `yaml:"title" json:"title,omitempty"`
}

func (*Annotations) UnmarshalYAML

func (a *Annotations) UnmarshalYAML(n *yaml.Node) error

type Document

type Document struct {
	MCP     string             `yaml:"mcp"`
	Info    Info               `yaml:"info"`
	Tools   map[string]*Tool   `yaml:"tools"`
	Schemas map[string]*Schema `yaml:"schemas"`
}

func Parse

func Parse(filename string, data []byte) (*Document, error)

func (*Document) Deref

func (d *Document) Deref(s *Schema) *Schema

func (*Document) JSONSchema

func (d *Document) JSONSchema(s *Schema) ([]byte, error)

JSONSchema normalizes local references to self-contained JSON Schema $defs.

type Info

type Info struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

type Schema

type Schema struct {
	Ref                  string             `yaml:"$ref" json:"$ref,omitempty"`
	Type                 string             `yaml:"type" json:"type,omitempty"`
	Description          string             `yaml:"description" json:"description,omitempty"`
	Required             []string           `yaml:"required" json:"required,omitempty"`
	Properties           map[string]*Schema `yaml:"properties" json:"properties,omitempty"`
	Items                *Schema            `yaml:"items" json:"items,omitempty"`
	Enum                 []any              `yaml:"enum" json:"enum,omitempty"`
	AdditionalProperties *bool              `yaml:"additionalProperties" json:"additionalProperties,omitempty"`
	Minimum              *float64           `yaml:"minimum" json:"minimum,omitempty"`
	Maximum              *float64           `yaml:"maximum" json:"maximum,omitempty"`
	ExclusiveMinimum     *float64           `yaml:"exclusiveMinimum" json:"exclusiveMinimum,omitempty"`
	ExclusiveMaximum     *float64           `yaml:"exclusiveMaximum" json:"exclusiveMaximum,omitempty"`
	MultipleOf           *float64           `yaml:"multipleOf" json:"multipleOf,omitempty"`
	MinLength            *int64             `yaml:"minLength" json:"minLength,omitempty"`
	MaxLength            *int64             `yaml:"maxLength" json:"maxLength,omitempty"`
	Pattern              string             `yaml:"pattern" json:"pattern,omitempty"`
	MinItems             *int64             `yaml:"minItems" json:"minItems,omitempty"`
	MaxItems             *int64             `yaml:"maxItems" json:"maxItems,omitempty"`
	UniqueItems          bool               `yaml:"uniqueItems" json:"uniqueItems,omitempty"`
	MinProperties        *int64             `yaml:"minProperties" json:"minProperties,omitempty"`
	MaxProperties        *int64             `yaml:"maxProperties" json:"maxProperties,omitempty"`
	Position             *yaml.Node         `yaml:"-" json:"-"`
}

func (*Schema) UnmarshalYAML

func (s *Schema) UnmarshalYAML(n *yaml.Node) error

type Tool

type Tool struct {
	Title       string       `yaml:"title"`
	Description string       `yaml:"description"`
	Input       *Schema      `yaml:"input"`
	Output      *Schema      `yaml:"output"`
	Annotations *Annotations `yaml:"annotations"`
	Position    *yaml.Node   `yaml:"-"`
}

func (*Tool) UnmarshalYAML

func (t *Tool) UnmarshalYAML(n *yaml.Node) error

Jump to

Keyboard shortcuts

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