- rbac/: Role type, constants, HasPermission, RoleFromString - blocks/: BlockFunc, BlockMeta, BlockContext, context accessors, BlockRegistry interface - templates/: TemplateFunc, meta types, TemplateRegistry interface - auth/: Claims, PublicClaims, context extractors - content/: Content interface, AuthorProfile/PageInfo/PostInfo types - settings/: Settings interface, map accessor helpers - gating/: AccessRule, AccessResult, EvaluateAccess, Gating interface - crypto/: Crypto interface (Encrypt/Decrypt) - render/: BlockNoteToHTML standalone renderer - video/: ParseEmbedURL, EmbedIframeURL - ai/: ToolDefinition, ToolResult, ToolRegistry interface Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
771 B
Go
29 lines
771 B
Go
package ai
|
|
|
|
import "context"
|
|
|
|
// ToolResult holds the output of a tool execution.
|
|
type ToolResult struct {
|
|
Content string `json:"content"`
|
|
Error string `json:"error,omitempty"`
|
|
}
|
|
|
|
// ToolHandler is the function signature for executing a tool.
|
|
type ToolHandler func(ctx context.Context, params map[string]any) (*ToolResult, error)
|
|
|
|
// ToolDefinition describes a registered tool.
|
|
type ToolDefinition struct {
|
|
Slug string
|
|
Name string
|
|
Description string
|
|
ParameterSchema map[string]any
|
|
Handler ToolHandler
|
|
}
|
|
|
|
// ToolRegistry is the interface for registering AI tools.
|
|
// Plugins use this to register their custom tools.
|
|
// The CMS provides the concrete implementation.
|
|
type ToolRegistry interface {
|
|
Register(tool *ToolDefinition)
|
|
}
|