Documentation
¶
Overview ¶
Package openapi is om's OpenAPI protocol: it compiles an OpenAPI 3.0–3.2 document into a core.Draft of operations, and each operation sends itself as an HTTP request with parameters serialized in the styles OpenAPI defines.
Only this package knows OpenAPI, kin-openapi, HTTP methods and parameter styles.
Index ¶
Constants ¶
const Format = 1
Format is the version of the OpenAPI model this package writes and serves. Raise it when a model of the current format can no longer be served the way this package would serve it, including when core's shared encoding of tools, inputs, credentials or definitions changes; every stored OpenAPI model then needs compiling again, and no other protocol's model is affected.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
func Decode(data json.RawMessage) ([]core.Operation, error)
Decode reads the operations of a model whose format is Format. An operation this package cannot send, such as one with an unknown parameter location or credential, or a path that does not begin with "/", fails the whole model.
Types ¶
type Location ¶
type Location string
Location is where an argument is sent, serialized in the style OpenAPI defines for it there: simple in a path or header, form in a query or cookie, and deepObject for a query object. https://spec.openapis.org/oas/v3.2.0.html#style-values
func (*Location) UnmarshalText ¶
type Operation ¶
type Operation struct {
core.Tool
Method string `json:"method"`
Path string `json:"path"`
Parameters []Parameter `json:"parameters,omitempty"`
Body bool `json:"body,omitempty"`
Security core.Security `json:"security,omitempty"`
}
Operation is one OpenAPI operation: the tool it is listed as and the HTTP request it sends.
func (Operation) Annotations ¶
func (o Operation) Annotations() *mcp.ToolAnnotations
Annotations follow HTTP's method semantics: GET, HEAD and OPTIONS are safe, PUT and DELETE idempotent. https://www.rfc-editor.org/rfc/rfc9110.html#section-9.2