schemaconv

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package schemaconv provides utilities for converting between schema formats.

Index

Constants

View Source
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

Jump to

Keyboard shortcuts

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