Class: Zephira::Tools::CodeSearch
- Defined in:
- lib/zephira/tools/code_search.rb
Instance Attribute Summary
Attributes inherited from BaseTool
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from BaseTool
announces_intent?, #arg, #error_result, #initialize, run, #success_result, #validate
Constructor Details
This class inherits a constructor from Zephira::Tools::BaseTool
Class Method Details
.description ⇒ Object
14 15 16 |
# File 'lib/zephira/tools/code_search.rb', line 14 def description "Search codebase for symbols or patterns" end |
.name ⇒ Object
10 11 12 |
# File 'lib/zephira/tools/code_search.rb', line 10 def name "code_search" end |
.parameters ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/zephira/tools/code_search.rb', line 22 def parameters { type: "object", properties: { queries: { type: "array", items: { type: "object", properties: { query: {type: "string", description: "String to search for"}, path: {type: "string", description: "Directory path to search"}, case_sensitive: {type: "boolean", description: "Enable case-sensitive search"}, max_results: {type: "integer", description: "Maximum number of results"} }, required: ["query", "path"] } }, intent: { type: "string", description: "Brief summary of intent of the operation, meant to be used for context compaction and presentation to the user. Use active voice (e.g., 'Reading X to do Y')." } }, required: ["queries", "intent"] } end |
.read_only? ⇒ Boolean
18 19 20 |
# File 'lib/zephira/tools/code_search.rb', line 18 def read_only? true end |
Instance Method Details
#run ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/zephira/tools/code_search.rb', line 49 def run queries = arg(:queries) unless queries.is_a?(Array) && !queries.empty? return error_result(message: "argument `queries` must be a non-empty array") end results = queries.map { |query_args| run_query(query_args) } success_result(results) end |