schemaconv

package
v0.0.0-...-adf2613 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 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 represents a JSON number type.
	// Summary: Defines TypeNumber.
	TypeNumber = "number"
	// TypeInteger represents a JSON integer type.
	// Summary: Defines TypeInteger.
	TypeInteger = "integer"
	// TypeBoolean represents a JSON boolean type.
	// Summary: Defines TypeBoolean.
	TypeBoolean = "boolean"
	// TypeObject represents a JSON object type.
	// Summary: Defines TypeObject.
	TypeObject = "object"
	// TypeArray represents a JSON array type.
	// Summary: Defines TypeArray.
	TypeArray = "array"
	// TypeString represents a JSON string type.
	// Summary: Defines TypeString.
	TypeString = "string"
)

JSON schema types.

View Source
const MaxRecursionDepth = 10

MaxRecursionDepth limits the depth of nested messages to prevent infinite recursion.

Summary: Represents a MaxRecursionDepth.

Variables

This section is empty.

Functions

func ConfigSchemaToProtoProperties

func ConfigSchemaToProtoProperties[T ConfigParameter](params []T) (*structpb.Struct, []string, 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.

Parameters:

  • params: A slice of parameters implementing ConfigParameter.

Returns:

  • *structpb.Struct: The properties structure for the input schema.
  • []string: A list of required parameter names.
  • error: An error if the conversion fails.

Summary: Executes ConfigSchemaToProtoProperties operation.

Parameters:

  • TODO: Document parameters.

Returns:

  • TODO: Document returns.

Errors:

  • TODO: Document errors.

Side Effects:

  • None.

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.

Parameters:

  • params: A slice of parameters implementing McpFieldParameter.

Returns:

  • *structpb.Struct: The properties structure for the input schema.
  • error: An error if the conversion fails.

Summary: Executes McpFieldsToProtoProperties operation.

Parameters:

  • TODO: Document parameters.

Returns:

  • TODO: Document returns.

Errors:

  • TODO: Document errors.

Side Effects:

  • None.

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.

Parameters:

  • methodDesc: The method descriptor to convert.

Returns:

  • *structpb.Struct: The properties structure for the input schema.
  • error: An error if the conversion fails.

Summary: Executes MethodDescriptorToProtoProperties operation.

Parameters:

  • TODO: Document parameters.

Returns:

  • TODO: Document returns.

Errors:

  • TODO: Document errors.

Side Effects:

  • None.

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.

Parameters:

  • methodDesc: The method descriptor to convert.

Returns:

  • *structpb.Struct: The properties structure for the output schema.
  • error: An error if the conversion fails.

Summary: Executes MethodOutputDescriptorToProtoProperties operation.

Parameters:

  • TODO: Document parameters.

Returns:

  • TODO: Document returns.

Errors:

  • TODO: Document errors.

Side Effects:

  • None.

Types

type ConfigParameter

type ConfigParameter interface {
	// GetSchema returns the parameter schema.
	//
	// Returns:
	//   - *configv1.ParameterSchema: The parameter schema.
	GetSchema() *configv1.ParameterSchema
}

ConfigParameter an interface for config parameter schemas.

Summary: Represents a ConfigParameter.

type McpFieldParameter

type McpFieldParameter interface {
	// GetName returns the name of the parameter.
	//
	// Returns:
	//   - string: The name of the parameter.
	GetName() string
	// GetDescription returns the description of the parameter.
	//
	// Returns:
	//   - string: The description of the parameter.
	GetDescription() string
	// GetType returns the type of the parameter.
	//
	// Returns:
	//   - string: The type of the parameter.
	GetType() string
	// GetIsRepeated returns true if the parameter is a repeated field (array).
	//
	// Returns:
	//   - bool: True if the parameter is repeated.
	GetIsRepeated() bool
}

McpFieldParameter an interface for McpField parameter schemas.

Summary: Represents a McpFieldParameter.

Jump to

Keyboard shortcuts

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