tools

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package tools defines tool input/output types and the execution interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndJourneyInput

type EndJourneyInput struct{}

EndJourneyInput is the input schema for the end_journey tool.

type EndJourneyResult

type EndJourneyResult struct {
	Ended bool `json:"ended"`
}

EndJourneyResult is the typed output of an end_journey tool execution.

func (EndJourneyResult) ToMap

func (r EndJourneyResult) ToMap() map[string]any

ToMap serializes the result for the GraphQL API.

type ErrorResult

type ErrorResult struct {
	Message string
}

ErrorResult represents a tool execution error.

type QueryInput

type QueryInput struct {
	SQL    string `json:"sql"`
	Status string `json:"status"`
	Result string `json:"result"`
}

QueryInput is the input schema for the query tool.

type QueryResult

type QueryResult struct {
	Rows []map[string]any `json:"rows"`
}

QueryResult is the typed output of a query tool execution.

func (QueryResult) ToMap

func (r QueryResult) ToMap() map[string]any

ToMap serializes the result for the GraphQL API.

type Result

type Result struct {
	ToolUseID    string
	Query        *QueryResult
	StartJourney *StartJourneyResult
	EndJourney   *EndJourneyResult
	Error        *ErrorResult
}

Result holds a typed tool result. Exactly one field is set.

func (Result) IsError

func (r Result) IsError() bool

IsError returns true if this result represents an error.

func (Result) ToMap

func (r Result) ToMap() map[string]any

ToMap serializes the result for the GraphQL API.

type StartJourneyInput

type StartJourneyInput struct {
	Name string `json:"name"`
}

StartJourneyInput is the input schema for the start_journey tool.

type StartJourneyResult

type StartJourneyResult struct {
	Started bool `json:"started"`
}

StartJourneyResult is the typed output of a start_journey tool execution.

func (StartJourneyResult) ToMap

func (r StartJourneyResult) ToMap() map[string]any

ToMap serializes the result for the GraphQL API.

type Tool

type Tool interface {
	Name() string
	Execute(input json.RawMessage) (Result, error)
}

Tool is the interface for executable tools.

Jump to

Keyboard shortcuts

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