Forge documentation
Library referenceGo

github.com/l1fe-labs/forge-go/tool

Go tool package.

Go tool package.

Package contract

FieldValue
Languagego
Source versionmodule source snapshot
Manifestforge-go/go.mod
Source files4
EvidenceSource reference; registry publication and runtime conformance are separate checks

Import boundary

import "github.com/l1fe-labs/forge-go/tool"

Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.

Source reference

Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.

approval.go

Read declaration text · 5 declaration entries

func AutoApproveHandler(_ core.ToolCall, _ core.ToolDefinition) core.ToolApproval

func DenyAllHandler(_ core.ToolCall, _ core.ToolDefinition) core.ToolApproval

func TierBasedHandler(externalApprover core.ToolApprovalHandler) core.ToolApprovalHandler

func AllowListHandler(allowed map[string]bool) core.ToolApprovalHandler

func DenyListHandler(denied map[string]bool) core.ToolApprovalHandler

definition.go

Read declaration text · 10 declaration entries

type DefinitionBuilder struct

func NewDefinitionBuilder(name string) *DefinitionBuilder

func (b *DefinitionBuilder) Description(desc string) *DefinitionBuilder

func (b *DefinitionBuilder) Tier(tier core.ToolTier) *DefinitionBuilder

func (b *DefinitionBuilder) Parameters(schema *core.JsonSchema) *DefinitionBuilder

func (b *DefinitionBuilder) Build() (core.ToolDefinition, error)

func (b *DefinitionBuilder) MustBuild() core.ToolDefinition

func PlatformTool(name, description string, params *core.JsonSchema) (core.ToolDefinition, error)

func ExternalTool(name, description string, params *core.JsonSchema) (core.ToolDefinition, error)

func EmbeddedTool(name, description string, params *core.JsonSchema) (core.ToolDefinition, error)

execution.go

Read declaration text · 4 declaration entries

type ExecutionResult struct

func ExecuteTool(ctx context.Context, registry *Registry, call core.ToolCall, approvalHandler core.ToolApprovalHandler) (*ExecutionResult, error)

func ExecuteToolCalls(ctx context.Context, registry *Registry, calls []core.ToolCall, approvalHandler core.ToolApprovalHandler) []core.ToolResult

func BuildToolResultMessage(results []core.ToolResult) core.ModelMessage

registry.go

Read declaration text · 11 declaration entries

type Handler func(arguments string) (string, error)

// Registration bundles a tool definition with its execution handler.
type Registration struct

type Registration struct

type Registry struct

func NewRegistry() *Registry

func (r *Registry) Register(def core.ToolDefinition, handler Handler) error

func (r *Registry) Unregister(name string) bool

func (r *Registry) Get(name string) (Registration, bool)

func (r *Registry) Has(name string) bool

func (r *Registry) Definitions() []core.ToolDefinition

func (r *Registry) Names() []string

func (r *Registry) Count() int

Continue

On this page