Documentation
¶
Overview ¶
Package openapi parses the subset of an OpenAPI 3.x document that mcpify needs to expose each operation as an MCP tool: the servers, and for every operation its method, path, parameters, and JSON request body. Schemas are returned as generic JSON-compatible trees with local $refs inlined, so a tool's input schema is self-contained for clients that cannot resolve references.
Swagger 2.0 documents are accepted too: they are converted into the same Document model at parse time (see swagger2.go), so nothing downstream needs a second code path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
Title string
APIVersion string
Servers []Server
Operations []Operation
// Warnings collects non-fatal notes from parsing, such as operations skipped
// because they consume formData. Callers surface these to the operator.
Warnings []string
}
Document is the parsed, mcpify-relevant view of an OpenAPI spec.
type Operation ¶
type Operation struct {
Method string // upper-case: GET, POST, ...
Path string // template form, e.g. /pets/{petId}
OperationID string
Summary string
Description string
Tags []string
Parameters []Parameter
RequestBody *RequestBody
}
Operation is a single path+method, the unit that becomes one MCP tool.
type Parameter ¶
type Parameter struct {
Name string
In string // path | query | header | cookie
Description string
Required bool
Schema map[string]any // JSON-schema fragment, $refs inlined
}
Parameter is a path, query, header, or cookie parameter.