Documentation
¶
Index ¶
- Variables
- func Build() fx.Option
- func ConfirmationDisabled(ctx context.Context) bool
- func ContextWithConfirmationDisabled(ctx context.Context) context.Context
- func ContextWithRunContext(ctx context.Context, run RunContext) context.Context
- type CatalogueTool
- type Handler
- type Registry
- func (p *Registry) AllToolIDs(ctx context.Context) []string
- func (p *Registry) GetTool(ctx context.Context, name string) (*Tool, error)
- func (p *Registry) GetTools(ctx context.Context, toolNames ...string) (Tools, error)
- func (p *Registry) GetToolsWithMissing(ctx context.Context, toolNames ...string) (Tools, []string)
- func (p *Registry) HasTool(name string) bool
- func (p *Registry) ListCatalogue(ctx context.Context) []CatalogueTool
- func (p *Registry) Register(tool *Tool) error
- func (p *Registry) RegisterAlias(alias string, target string)
- func (p *Registry) Unregister(name string)
- func (p *Registry) UnregisterPrefix(prefix string)
- type RunContext
- type Tool
- type ToolResult
- type Tools
- type Toolset
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrToolNotFound = fault.New("tool not found") ErrToolAlreadyRegistered = fault.New("tool already registered") )
View Source
var DefaultTools = []string{
"content_search",
"system_robot_tool_catalog",
"robot_switch",
"robot_create",
"robot_list",
"robot_get",
"robot_update",
"robot_delete",
"throw_an_error",
}
Functions ¶
func ConfirmationDisabled ¶
func ContextWithRunContext ¶
func ContextWithRunContext(ctx context.Context, run RunContext) context.Context
Types ¶
type CatalogueTool ¶
type Handler ¶
type Handler func(ctx context.Context, args json.RawMessage) (json.RawMessage, error)
Handler is a context.Context-based handler for use by non-ADK transports (e.g. the MCP SSE transport). It receives raw JSON arguments and returns raw JSON output, avoiding a dependency on google.golang.org/adk/tool.Context.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (*Registry) GetToolsWithMissing ¶
func (*Registry) ListCatalogue ¶
func (p *Registry) ListCatalogue(ctx context.Context) []CatalogueTool
func (*Registry) RegisterAlias ¶
func (*Registry) Unregister ¶
func (*Registry) UnregisterPrefix ¶
type RunContext ¶
func RunContextFromContext ¶
func RunContextFromContext(ctx context.Context) RunContext
type Tool ¶
type Tool struct {
Definition *mcp.ToolDefinition
// Source identifies where the tool came from for catalogues and UI labels.
// Empty means a built-in Storyden tool.
Source string
// CallableName is the name exposed to ADK/model providers. Native tools use
// Definition.Name; dynamic MCP tools may need a stricter generated name.
CallableName string
// Builder actually constructs the executor function dynamically. This is
// useful for tools that depend on runtime context, like database data.
Builder func(context.Context) (adktool.Tool, error)
Handler Handler
IsClientTool bool
}
Tool is a wrapper around an actual tool definition, it includes the actual executor as well as the definition and a flag for if it's a client-side tool.
func (*Tool) Description ¶
func (*Tool) IsLongRunning ¶
type ToolResult ¶
type ToolResult[T any] struct { Result T `json:"result,omitempty"` Error string `json:"error,omitempty"` }
ToolResult is just because adk doesn't allow returning an error. Since adk just serialises the return into json, this lets us tell the LLM about errors.
func NewError ¶
func NewError[T any](err error) ToolResult[T]
func NewErrorMsg ¶
func NewErrorMsg[T any](msg string) ToolResult[T]
func NewSuccess ¶
func NewSuccess[T any](v T) ToolResult[T]
Click to show internal directories.
Click to hide internal directories.