tools

package
v1.9.24 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertSchema added in v1.7.1

func ConvertSchema(params, v any) error

func MustSchemaFor added in v1.7.1

func MustSchemaFor[T any]() any

func SchemaFor added in v1.7.1

func SchemaFor[T any]() (any, error)

func SchemaToMap added in v1.7.1

func SchemaToMap(params any) (map[string]any, error)

Types

type ElicitationAction added in v1.9.14

type ElicitationAction string
const (
	ElicitationActionAccept  ElicitationAction = "accept"
	ElicitationActionDecline ElicitationAction = "decline"
	ElicitationActionCancel  ElicitationAction = "cancel"
)

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  ElicitationAction `json:"action"`
	Content map[string]any    `json:"content,omitempty"`
}

type ElicitationTool added in v1.8.0

type ElicitationTool struct{}

func (*ElicitationTool) SetElicitationHandler added in v1.8.0

func (t *ElicitationTool) SetElicitationHandler(ElicitationHandler)

func (*ElicitationTool) SetManagedOAuth added in v1.9.14

func (t *ElicitationTool) SetManagedOAuth(bool)

func (*ElicitationTool) SetOAuthSuccessHandler added in v1.8.0

func (t *ElicitationTool) SetOAuthSuccessHandler(func())

type FunctionCall

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

type Tool

type Tool struct {
	Name         string          `json:"name"`
	Category     string          `json:"category"`
	Description  string          `json:"description,omitempty"`
	Parameters   any             `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(ctx context.Context) error
	SetElicitationHandler(handler ElicitationHandler)
	SetOAuthSuccessHandler(handler func())
	SetManagedOAuth(managed bool)
}

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