Module: SolidAgent::HasTools
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/solid_agent/has_tools.rb
Defined Under Namespace
Classes: ToolBuilder
Instance Method Summary collapse
-
#reload_tools! ⇒ Array<Hash>
Reloads tools, clearing any cached schemas.
-
#tools ⇒ Array<Hash>
Returns all tool schemas for this agent.
Instance Method Details
#reload_tools! ⇒ Array<Hash>
Reloads tools, clearing any cached schemas.
Useful when tool templates may have changed during development.
124 125 126 127 |
# File 'lib/solid_agent/has_tools.rb', line 124 def reload_tools! @_tools_cache = nil tools end |
#tools ⇒ Array<Hash>
Returns all tool schemas for this agent.
Combines tools from:
- Auto-discovered JSON templates (if has_tools called without args)
- Explicitly listed tools (if has_tools called with args)
- Inline tool definitions (from tool blocks)
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/solid_agent/has_tools.rb', line 101 def tools @_tools_cache ||= begin schemas = [] # Load from templates if _tools_auto_discover schemas.concat(discover_tool_templates) elsif _tool_names.any? schemas.concat(_tool_names.map { |name| load_tool_schema(name) }) end # Add inline tools schemas.concat(_inline_tools.values) schemas end end |