Tool
Object Hierarchy:
Description:
Parsed tool call (refinement) and/or one execution run.
Refinement: run_id == ""; stored in task.tools. Use parse(), validate(), to_instructions(). Execution run: run_id set; references and
optionally tool_call. run() runs the tool (if any) then the LLM executor; result in summary and document.
See also:
Details
Content:
Properties:
- public Object? arguments { get; set; }
Parsed "arguments" object, or null if absent. Set by parse().
- public Document? document { get; set; }
Executor output document. Set by ResultParser.exec_extract() on
success.
- public string id { get; set; }
Execution run id (e.g. "tool-0", "ref-1", "exec"). Empty for
refinement-only.
- public string issues { get; set; }
Validation or parse error messages; appended by parse() and
validate().
- public string name { get; set; }
Tool name from parsed JSON (e.g. "write_file").
- public unowned Details parent { get; set; }
The task (Details) this tool belongs to.
- public ArrayList<Format> references { get; set; }
References for this run (one or more). Used by reference_contents() to
build executor input.
- public string summary { get; set; }
Result summary from executor (Result summary section). Set by
ResultParser.exec_extract().
- public ToolCall? tool_call { get; set; }
ToolCall built from name and arguments; set by parse(), used in run()
when this run has a tool.
- public string tool_run_result { get; set; }
Tool execution result from this run. Set in run() when this run has a
tool_call.
Creation methods:
Methods:
- public bool parse (Block block)
Parses a fenced block: expects JSON with "name" and optional
"arguments". Sets this.name, this.arguments, and this.tool_call (uid is assigned by caller via assign_id). Appends to this.issues on
parse failures.
- public async void run () throws Error
Run the tool (if any), build reference content + tool output, combine
for executor input, send executor prompt, parse into summary and document. Up to 5 attempts; on failure appends to parent.issues and
throws.
- public string to_instructions ()
Returns instructions for the refine stage: tool name, description, and
parameters. Uses this.name to look up the tool from the manager. Call after constructing the Tool with name set.
- public bool validate ()
Validates that tool_call is set, the tool is registered on the
manager, and required arguments are present. Appends to this.issues for refine feedback.
Inherited Members:
All known members inherited from class OLLMchat.Agent.Base
All known members inherited from class GLib.Object
- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data
- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer
- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref
All known members inherited from interface OLLMchat.Agent.Interface