PtcRunner.SubAgent.Prompt.Tools (PtcRunner v0.4.1)

View Source

Tool schema section generation for SubAgent prompts.

Generates the Available Tools section that shows all available tools with their signatures and descriptions. Optionally includes a separate "Tools for planning (do not call)" section for tools in the catalog.

Summary

Functions

generate(tools, tool_catalog \\ nil, multi_turn? \\ true)

@spec generate(map(), map() | nil, boolean()) :: String.t()

Generate the tool schemas section.

Shows all available tools with their signatures and descriptions. Optionally includes a separate "Tools for planning (do not call)" section for tools in the catalog.

Parameters

  • tools - Map of tool name to function
  • tool_catalog - Optional map of tool names for planning (default: nil)

Returns

A string containing the tool schemas section.

Examples

iex> tools = %{"add" => fn %{x: x, y: y} -> x + y end}
iex> schemas = PtcRunner.SubAgent.Prompt.Tools.generate(tools)
iex> schemas =~ "# Available Tools"
true

iex> tools = %{"search" => fn _ -> [] end}
iex> catalog = %{"email_agent" => nil}
iex> schemas = PtcRunner.SubAgent.Prompt.Tools.generate(tools, catalog)
iex> schemas =~ "## Tools for planning (do not call)"
true