Skip to content
Kward Search API index

Class: Kward::Tools::SummarizeFileStructure

Inherits:
Base
  • Object
show all
Defined in:
lib/kward/tools/summarize_file_structure.rb

Overview

Returns a compact symbol outline for a workspace source file.

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#schema

Constructor Details

#initialize(workspace:) ⇒ SummarizeFileStructure

Builds the tool schema and stores the execution dependency.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kward/tools/summarize_file_structure.rb', line 10

def initialize(workspace:)
  @workspace = workspace
  super(
    "summarize_file_structure",
    "Return a compact outline of classes, modules, methods, and functions in a workspace source file.",
    properties: {
      path: { type: "string", description: "Workspace-relative source file path." }
    },
    required: ["path"]
  )
end

Instance Method Details

#call(args, _conversation, cancellation: nil) ⇒ Object

Executes the structure summary tool.



23
24
25
26
# File 'lib/kward/tools/summarize_file_structure.rb', line 23

def call(args, _conversation, cancellation: nil)
  cancellation&.raise_if_cancelled!
  @workspace.summarize_file_structure(argument(args, :path, ""))
end