Documentation
¶
Overview ¶
Package schemaconv provides utilities for converting between schema formats.
Index ¶
- Constants
- func ConfigSchemaToProtoProperties[T ConfigParameter](params []T) (*structpb.Struct, error)
- func McpFieldsToProtoProperties[T McpFieldParameter](params []T) (*structpb.Struct, error)
- func MethodDescriptorToProtoProperties(methodDesc protoreflect.MethodDescriptor) (*structpb.Struct, error)
- func MethodOutputDescriptorToProtoProperties(methodDesc protoreflect.MethodDescriptor) (*structpb.Struct, error)
- type ConfigParameter
- type McpFieldParameter
Constants ¶
const ( TypeNumber = "number" TypeInteger = "integer" TypeBoolean = "boolean" )
JSON schema types
Variables ¶
This section is empty.
Functions ¶
func ConfigSchemaToProtoProperties ¶
func ConfigSchemaToProtoProperties[T ConfigParameter](params []T) (*structpb.Struct, error)
ConfigSchemaToProtoProperties converts a slice of parameter schema definitions from a service configuration into a `structpb.Struct` that can be used as the `properties` field in a protobuf-based tool input schema.
func McpFieldsToProtoProperties ¶
func McpFieldsToProtoProperties[T McpFieldParameter](params []T) (*structpb.Struct, error)
McpFieldsToProtoProperties converts a slice of McpField definitions into a `structpb.Struct` that can be used as the `properties` field in a protobuf-based tool input schema.
func MethodDescriptorToProtoProperties ¶
func MethodDescriptorToProtoProperties(methodDesc protoreflect.MethodDescriptor) (*structpb.Struct, error)
MethodDescriptorToProtoProperties converts the fields of a method's input message into a `structpb.Struct` for use as the `properties` field in a tool input schema.
func MethodOutputDescriptorToProtoProperties ¶
func MethodOutputDescriptorToProtoProperties(methodDesc protoreflect.MethodDescriptor) (*structpb.Struct, error)
MethodOutputDescriptorToProtoProperties converts the fields of a method's output message into a `structpb.Struct` for use as the `properties` field in a tool output schema.
Types ¶
type ConfigParameter ¶
type ConfigParameter interface {
// GetSchema returns the parameter schema.
GetSchema() *configv1.ParameterSchema
}
ConfigParameter an interface for config parameter schemas
type McpFieldParameter ¶
type McpFieldParameter interface {
// GetName returns the name of the parameter.
GetName() string
// GetDescription returns the description of the parameter.
GetDescription() string
// GetType returns the type of the parameter.
GetType() string
}
McpFieldParameter an interface for McpField parameter schemas