tooldef

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package tooldef provides JSON Schema tool definitions for AI agent frameworks.

These definitions are compatible with OpenAI function-calling, Anthropic tool_use, Google Gemini function declarations, and any framework that accepts JSON Schema (LangChain, Vercel AI SDK, Semantic Kernel, etc.).

Usage:

tools := tooldef.AllTools()
// Register with your agent framework's tool system

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateParams added in v0.5.0

func ValidateParams(def ToolDef, params map[string]interface{}) error

ValidateParams checks parameter values against the tool's schema constraints (enums, required fields). Returns an error describing the first invalid parameter found, or nil if all values are valid.

Types

type Schema

type Schema struct {
	Type        string            `json:"type"`
	Description string            `json:"description,omitempty"`
	Properties  map[string]Schema `json:"properties,omitempty"`
	Required    []string          `json:"required,omitempty"`
	Enum        []string          `json:"enum,omitempty"`
	Default     string            `json:"default,omitempty"`
	Items       *Schema           `json:"items,omitempty"`
	OneOf       [][]string        `json:"-"`
}

Schema is a minimal JSON Schema representation.

OneOf encodes mutually-exclusive property groups. Each inner slice is a set of property names where exactly one MUST be provided. This is a pragmatic subset of JSON Schema's full `oneOf` (which takes sub-schemas) — sufficient for our XOR-style tool inputs (e.g. `prompt` vs `image_url` vs `image_urls`) without dragging in a full schema validator.

type ToolDef

type ToolDef struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Parameters  Schema `json:"parameters"`
	Category    string `json:"category,omitempty"` // media type category: "image", "video", "audio", "3d", "music", "voice", "sfx"
}

ToolDef describes a callable tool with its JSON Schema parameters.

func AllTools

func AllTools() []ToolDef

AllTools returns every pre-defined tool aigo can provide.

func DesignVoice

func DesignVoice() ToolDef

DesignVoice returns the tool definition for custom voice creation.

func EditImage

func EditImage() ToolDef

EditImage returns the tool definition for image editing.

func EditVideo added in v0.7.0

func EditVideo() ToolDef

EditVideo returns the tool definition for video editing.

func Generate3D added in v0.14.0

func Generate3D() ToolDef

Generate3D returns the tool definition for 3D model generation.

Inputs are mutually exclusive: provide one of `prompt`, `image_url`, or `image_urls` (multi-image, 2-4 entries). Tripo-style providers also accept `texture_quality` and `geometry_quality` for fidelity tuning.

func GenerateImage

func GenerateImage() ToolDef

GenerateImage returns the tool definition for image generation.

func GenerateMusic added in v0.10.0

func GenerateMusic() ToolDef

GenerateMusic returns the tool definition for AI music generation.

func GenerateSfx added in v0.33.0

func GenerateSfx() ToolDef

GenerateSfx returns the tool definition for sound effects generation.

func GenerateVideo

func GenerateVideo() ToolDef

GenerateVideo returns the tool definition for video generation.

func MixAudio added in v0.33.0

func MixAudio() ToolDef

MixAudio returns the tool definition for mixing multiple audio tracks.

func SearchMaterial added in v0.35.0

func SearchMaterial() ToolDef

SearchMaterial returns the tool definition for material/asset search.

func TextToSpeech

func TextToSpeech() ToolDef

TextToSpeech returns the tool definition for text-to-speech synthesis.

func ToolsFor added in v0.15.0

func ToolsFor(categories ...string) []ToolDef

ToolsFor returns tools matching the given category (e.g., "image", "video", "audio", "3d", "music"). Multiple categories can be passed; tools matching any of them are included.

func TranscribeAudio

func TranscribeAudio() ToolDef

TranscribeAudio returns the tool definition for audio transcription.

func UnderstandImage added in v0.26.0

func UnderstandImage() ToolDef

UnderstandImage returns the tool definition for image understanding / vision analysis.

Jump to

Keyboard shortcuts

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