Skip to main content

mellea.plugins.hooks.tool

Tool execution hook payloads.

Classes

CLASS ToolPreInvokePayload

Payload for tool_pre_invoke — before tool/function invocation.

Attributes:

  • model_tool_call: The ModelToolCall about to be executed (writable — plugins may modify arguments or swap the tool entirely).
  • is_control_flow: True when this tool is used for framework control flow (e.g. final_answer in ReAct) rather than data processing. Plugins should check this field to decide whether to act.

CLASS ToolPostInvokePayload

Payload for tool_post_invoke — after tool execution.

Attributes:

  • model_tool_call: The ModelToolCall that was executed.
  • tool_output: The return value of the tool function (writable — plugins may transform the output before it is formatted).
  • tool_message: The ToolMessage constructed from the output.
  • execution_time_ms: Wall-clock time of the tool execution in milliseconds.
  • success: True if the tool executed without raising an exception.
  • error: The Exception raised during execution, or None on success.
  • is_control_flow: True when this tool is used for framework control flow (e.g. final_answer in ReAct) rather than data processing. Plugins should check this field to decide whether to act.