tools

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToOutputSchemaSchema added in v1.5.14

func ToOutputSchemaSchema(valueType reflect.Type) (*jsonschema.Schema, error)

func ToOutputSchemaSchemaMust added in v1.7.0

func ToOutputSchemaSchemaMust(valueType reflect.Type) *jsonschema.Schema

Types

type ElicitationHandler added in v1.7.0

type ElicitationHandler func(ctx context.Context, req *mcp.ElicitParams) (ElicitationResult, error)

ElicitationHandler is a function type that handles elicitation requests from the MCP server This allows the runtime to handle elicitation requests and propagate them to its own client

type ElicitationResult added in v1.7.0

type ElicitationResult struct {
	Action  string         `json:"action"` // "accept", "decline", or "cancel"
	Content map[string]any `json:"content,omitempty"`
}

type FunctionCall

type FunctionCall struct {
	Name      string `json:"name,omitempty"`
	Arguments string `json:"arguments,omitempty"`
}

type FunctionParameters added in v1.5.4

type FunctionParameters struct {
	Type       string         `json:"type"`
	Properties map[string]any `json:"properties"`
	Required   []string       `json:"required,omitempty"`
}

func (FunctionParameters) MarshalJSON added in v1.5.4

func (fp FunctionParameters) MarshalJSON() ([]byte, error)

type Tool

type Tool struct {
	Name         string             `json:"name"`
	Description  string             `json:"description,omitempty"`
	Parameters   FunctionParameters `json:"parameters"`
	Annotations  ToolAnnotations    `json:"annotations"`
	OutputSchema any                `json:"outputSchema"`
	Handler      ToolHandler        `json:"-"`
}

func (*Tool) DisplayName added in v0.7.0

func (t *Tool) DisplayName() string

type ToolAnnotations added in v1.7.0

type ToolAnnotations mcp.ToolAnnotations

type ToolCall

type ToolCall struct {
	ID       string       `json:"id,omitempty"`
	Type     ToolType     `json:"type"`
	Function FunctionCall `json:"function"`
}

type ToolCallResult

type ToolCallResult struct {
	Output string `json:"output"`
}

type ToolHandler

type ToolHandler = func(ctx context.Context, toolCall ToolCall) (*ToolCallResult, error)

type ToolSet

type ToolSet interface {
	Tools(ctx context.Context) ([]Tool, error)
	Instructions() string
	Start(ctx context.Context) error
	Stop() error
	SetElicitationHandler(handler ElicitationHandler)
	SetOAuthSuccessHandler(handler func())
}

type ToolType

type ToolType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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