model

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 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 model is PlugIt's canonical intermediate representation of an API (SPEC §3.4). Ingesters produce a Manifest; curation, lint, token estimation and serving consume it. The package is pure: no I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	ContentType string              `json:"contentType"`
	Schema      json.RawMessage     `json:"schema"`
	Required    bool                `json:"required,omitempty"`
	Encoding    map[string]Encoding `json:"encoding,omitempty"`
}

Body is a tool's request body.

type Encoding

type Encoding struct {
	Style   string `json:"style,omitempty"`
	Explode bool   `json:"explode"`
}

Encoding is how one form field is serialized (an OpenAPI encoding object, with explode resolved). Fields without one use style form, explode true.

type Issue

type Issue struct {
	Kind   IssueKind `json:"kind"`
	Detail string    `json:"detail"`
}

Issue is a problem found while ingesting one tool.

type IssueKind

type IssueKind string

IssueKind classifies an ingest problem. Lint rules map these to findings.

const (
	IssueSchemaDegraded IssueKind = "schema-degraded"
	IssueBodyNested     IssueKind = "body-nested"
	IssueUnsupported    IssueKind = "unsupported"
	IssueHiddenText     IssueKind = "hidden-text"
)

Ingest issue kinds.

type Location

type Location int

Location is where an argument is sent in the HTTP request.

const (
	InPath Location = iota
	InQuery
	InHeader
	InCookie
	InBody
	InBodyRoot
)

Argument locations.

func ParseLocation

func ParseLocation(s string) (Location, bool)

ParseLocation parses a location name as produced by Location.String.

func (Location) MarshalJSON

func (l Location) MarshalJSON() ([]byte, error)

MarshalJSON encodes l as its name.

func (Location) String

func (l Location) String() string

func (*Location) UnmarshalJSON

func (l *Location) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a name produced by MarshalJSON.

type Manifest

type Manifest struct {
	Title       string   `json:"title"`
	Version     string   `json:"version"`
	SpecVersion string   `json:"specVersion"`
	Servers     []string `json:"servers,omitempty"`
	Tools       []Tool   `json:"tools"`
	Warnings    []string `json:"warnings,omitempty"`
}

Manifest is the result of ingesting one spec.

type OpKey

type OpKey string

OpKey is a tool's stable identity across renames and syncs: "METHOD /path/template", e.g. "GET /repos/{owner}/{repo}/issues".

func NewOpKey

func NewOpKey(method, path string) OpKey

NewOpKey builds an OpKey with an upper-case method.

func (OpKey) Method

func (k OpKey) Method() string

Method returns the HTTP method part of k.

func (OpKey) Path

func (k OpKey) Path() string

Path returns the path template part of k.

type Param

type Param struct {
	Name         string          `json:"name"`
	UpstreamName string          `json:"upstreamName"`
	In           Location        `json:"in"`
	Required     bool            `json:"required,omitempty"`
	Schema       json.RawMessage `json:"schema"`
	Desc         string          `json:"desc,omitempty"`
	Hidden       bool            `json:"hidden,omitempty"`
}

Param is one argument of a tool.

type Safety

type Safety int

Safety classifies what calling a tool can do.

const (
	ReadOnly Safety = iota
	Write
	Destructive
)

Safety levels, from least to most dangerous.

func SafetyForMethod

func SafetyForMethod(method string) Safety

SafetyForMethod classifies an HTTP method. Unknown methods are treated as Destructive so that they fail closed under every policy mode.

func (Safety) MarshalJSON

func (s Safety) MarshalJSON() ([]byte, error)

MarshalJSON encodes s as its name.

func (Safety) String

func (s Safety) String() string

func (*Safety) UnmarshalJSON

func (s *Safety) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a name produced by MarshalJSON.

type Tool

type Tool struct {
	Key         OpKey    `json:"key"`
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Method      string   `json:"method"`
	Path        string   `json:"path"`
	Params      []Param  `json:"params,omitempty"`
	Body        *Body    `json:"body,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Deprecated  bool     `json:"deprecated,omitempty"`
	Safety      Safety   `json:"safety"`
	Issues      []Issue  `json:"issues,omitempty"`
}

Tool is one API operation exposed (or exposable) as an MCP tool.

Jump to

Keyboard shortcuts

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