Class: Protege::Generators::ToolGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
ExtensionNaming
Defined in:
lib/generators/protege/tool/tool_generator.rb

Overview

Scaffolds a Protege tool — a capability the agent can invoke mid-conversation — into the host app's tools directory (+config.tools_path+, default app/tools). A tool subclasses Protege::Tool, declares its description and JSON input_schema for the model, and implements use; the harness auto-discovers it (no manual registration) and publishes it in the LLM's tool catalog.

The Tool suffix is applied for you, so all of send_email, SendEmail, and SendEmailTool produce class SendEmailTool in send_email_tool.rb.

Examples:

bin/rails g protege:tool send_email

Instance Method Summary collapse

Instance Method Details

#create_toolvoid

This method returns an undefined value.

Render the tool scaffold into config.tools_path.



29
30
31
# File 'lib/generators/protege/tool/tool_generator.rb', line 29

def create_tool
  template 'tool.rb.tt', File.join(Protege.configuration.tools_path, "#{extension_file_name('Tool')}.rb")
end