PtcRunner.SubAgent.Namespace.Tool (PtcRunner v0.9.0)

Copy Markdown View Source

Renders available tools for the USER message namespace section.

Summary

Functions

Render tools section for USER message.

Functions

render(tools)

@spec render(map()) :: String.t()

Render tools section for USER message.

Returns a formatted string showing available tools or a message indicating no tools are available. When tools exist, shows header and entries with tool calling syntax, parameters, and return type.

Tools are called using tool/ prefix: (tool/tool-name {:param value})

Accepts raw tool formats (fn, {fn, sig}, {fn, opts}) and normalizes them.

Examples

iex> PtcRunner.SubAgent.Namespace.Tool.render(%{})
";; No tools available"

iex> tool = %PtcRunner.Tool{name: "get-inventory", signature: "-> :map"}
iex> PtcRunner.SubAgent.Namespace.Tool.render(%{"get-inventory" => tool})
";; === tools ===\ntool/get-inventory() -> map\n;; Call with named args: (tool/name {:key value})"

iex> tool = %PtcRunner.Tool{name: "search", signature: "(query :string, limit :int) -> [:string]"}
iex> PtcRunner.SubAgent.Namespace.Tool.render(%{"search" => tool})
";; === tools ===\ntool/search(query string, limit int) -> [string]\n;; Example: (tool/search {:query ... :limit ...})"

iex> tool = %PtcRunner.Tool{name: "analyze", signature: "-> :map", description: "Analyze data"}
iex> PtcRunner.SubAgent.Namespace.Tool.render(%{"analyze" => tool})
";; === tools ===\ntool/analyze() -> map  ; Analyze data\n;; Call with named args: (tool/name {:key value})"