tool

package
v0.0.0-...-1fe7fe5 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalRequiredTool

type ApprovalRequiredTool interface {
	Tool

	// ApprovalRequired reports whether the tool requires user approval before invocation.
	ApprovalRequired() bool
}

ApprovalRequiredTool indicates whether a tool requires user approval before invocation.

type FuncTool

type FuncTool interface {
	SchemaTool

	// Call invokes the tool with raw JSON arguments.
	Call(ctx context.Context, args string) (any, error)
}

FuncTool describes a schema-aware tool that can be invoked by an agent.

func ApprovalRequiredFunc

func ApprovalRequiredFunc(t FuncTool) FuncTool

ApprovalRequiredFunc wraps a tool to indicate that it requires user approval before invocation. If the tool already requires approval, it is returned as-is. Not all tools support approval, in which case the original tool is returned.

type SchemaTool

type SchemaTool interface {
	Tool

	// Schema returns the tool input schema.
	Schema() any

	// ReturnSchema returns the tool output schema.
	ReturnSchema() any
}

SchemaTool describes a tool that exposes input and output schemas.

type Tool

type Tool interface {
	// Name returns the provider-facing tool name.
	Name() string

	// Description returns the provider-facing tool description.
	Description() string
}

Tool describes a tool that can be made available to an agent.

type ToolMode

type ToolMode string

ToolMode represents how tools should be used by the agent.

const (
	// ToolModeAuto allows the agent to decide when to use tools.
	ToolModeAuto ToolMode = "auto"

	// ToolModeRequired forces the agent to use at least one tool.
	ToolModeRequired ToolMode = "required"

	// ToolModeNone disables tool usage.
	ToolModeNone ToolMode = "none"
)

func RequireTools

func RequireTools(name ...string) ToolMode

RequireTools returns a ToolMode that requires the named tools to be used.

func (ToolMode) Mode

func (m ToolMode) Mode() ToolMode

Mode returns the base tool mode represented by m. Modes created by RequireTools return ToolModeRequired.

func (ToolMode) Required

func (m ToolMode) Required() []string

Required returns the specific tool names required by m. It returns nil unless m was created by RequireTools.

Directories

Path Synopsis
Package hostedtool provides definitions for hosted tools.
Package hostedtool provides definitions for hosted tools.
Package mcp provides integration with the Model Context Protocol (MCP).
Package mcp provides integration with the Model Context Protocol (MCP).
Package shelltool provides a shell command execution tool that can be registered with an agent.
Package shelltool provides a shell command execution tool that can be registered with an agent.

Jump to

Keyboard shortcuts

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