Class: Rubydex::MCPServer::CodebaseStatsTool

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/rubydex/mcp_server/tools/codebase_stats_tool.rb

Constant Summary

Constants inherited from BaseTool

BaseTool::DEFAULT_LIMIT

Instance Method Summary collapse

Methods inherited from BaseTool

#declaration_kind, #display_location, #document_for_path, #file_path_for_uri, #format_path, #initialize, #lookup_declaration, #paginate, #response

Methods inherited from Tool

description, inherited, input_schema, to_h, tool_name, tools_by_name

Constructor Details

This class inherits a constructor from Rubydex::MCPServer::BaseTool

Instance Method Details

#callObject

: -> Tool::Response



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rubydex/mcp_server/tools/codebase_stats_tool.rb', line 11

def call
  declaration_count = 0
  breakdown = Hash.new(0)
  @graph.declarations.each do |declaration|
    declaration_count += 1
    breakdown[declaration_kind(declaration)] += 1
  end

  response(
    files: @graph.documents.count,
    declarations: declaration_count,
    definitions: @graph.documents.sum { |document| document.definitions.count },
    constant_references: @graph.constant_references.count,
    method_references: @graph.method_references.count,
    breakdown_by_kind: breakdown,
  )
end