Documentation
¶
Overview ¶
Package mcptype compares MCP typed contracts and generates typed client packages.
Index ¶
- Constants
- func Changes(expected, published *mcpcontract.Metadata) ([]string, error)
- func CheckTool(tool mcpcontract.Tool) error
- func Generate(ctx context.Context, options GenerateRequest) (map[string][]byte, error)
- func ParseMetadata(data []byte) (*mcpcontract.Metadata, error)
- func SameContract(a, b *mcpcontract.Contract) (bool, error)
- type GenerateRequest
- type Object
- type Value
Constants ¶
const PythonOwnTypes = "_own.py"
const TypeScriptDeclarations = "index.d.mts"
const TypeScriptModule = "index.mjs"
TypeScriptModule is the generated clients' module, beside its declarations in index.d.mts. Its .mjs keeps it an ES module in a CommonJS project.
Variables ¶
This section is empty.
Functions ¶
func Changes ¶
func Changes(expected, published *mcpcontract.Metadata) ([]string, error)
Changes describes each way published breaks expected if it is deployed: identity first, then tools by name, then resources by URI. Empty means compatible.
func CheckTool ¶
func CheckTool(tool mcpcontract.Tool) error
CheckTool requires a valid MCP name and an MCP Tool inputSchema that is an object of type object.
func ParseMetadata ¶
func ParseMetadata(data []byte) (*mcpcontract.Metadata, error)
ParseMetadata decodes a contract document, or reports why data is not one.
func SameContract ¶
func SameContract(a, b *mcpcontract.Contract) (bool, error)
SameContract reports whether two contracts are equal once annotations are removed and unordered keywords sorted.
Types ¶
type GenerateRequest ¶
type GenerateRequest struct {
Target string `json:"target"`
Identity mcpcontract.Identity `json:"identity"`
Requires map[string]mcpcontract.Identity `json:"requires,omitempty"`
Contracts map[string]*mcpcontract.Contract `json:"contracts,omitempty"`
Own string `json:"own,omitempty"`
OwnTools *mcpcontract.Contract `json:"own_tools,omitempty"`
App string `json:"app,omitempty"`
GoModule string `json:"go_module,omitempty"`
}
GenerateRequest asks for one target's typed client package: node, browser, python or go. Empty optional strings use their defaults; GoModule is required for Go.