Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ToolFunc ¶
ToolFunc defines the signature for a generic Go function that can be wrapped as a tool. It accepts a context and a strongly-typed input, and returns a strongly-typed output and an error.
type Wrapper ¶
Wrapper adapts a generic ToolFunc into the universal core.Action interface. This allows any regular Go function to be managed, supervised, and traced by Manglekit.
func New ¶
New creates a new Action wrapper for the provided function.
Parameters:
- name: The unique name of the action.
- fn: The function to wrap.
Returns:
- A pointer to the initialized Wrapper.
func (*Wrapper[In, Out]) Execute ¶
Execute performs the action logic. It automatically handles type assertion from the generic Envelope payload to the function's input type, and wraps the function's output back into an Envelope.
Parameters:
- ctx: The execution context.
- input: The input Envelope.
Returns:
- The result Envelope, or an error if type assertion or execution fails.
func (*Wrapper[In, Out]) Metadata ¶
func (w *Wrapper[In, Out]) Metadata() core.ActionMetadata
Metadata returns the action's metadata (name and type "function").
func (*Wrapper[In, Out]) SetContentType ¶
func (w *Wrapper[In, Out]) SetContentType(ct core.ContentType)
SetContentType allows configuring the expected input content type (e.g., JSON vs Struct).