LlmEx.ToolHandler (LlmEx v0.1.0)

View Source

Shared functionality for handling tools across different LLM clients. Provides common methods for executing tool calls, parsing arguments, and processing results.

Summary

Functions

Execute a tool call and return the result.

Parse tool arguments from various formats into a map.

Process various tool result formats into a standardized format.

Functions

execute_tool_call(tool_name, args, opts \\ [])

Execute a tool call and return the result.

Parameters

  • tool_name - Name of the tool to execute
  • args - Arguments to pass to the tool
  • opts - Additional options

Returns

  • Map containing either a result or an error

parse_tool_arguments(args)

Parse tool arguments from various formats into a map.

Parameters

  • args - Arguments to parse (string, map, or other)

Returns

  • Map of parsed arguments

process_tool_result(result)

Process various tool result formats into a standardized format.

Returns

  • Map with either a "result" or "error" key