Class: ClaudeMemory::MCP::Tools
- Inherits:
-
Object
- Object
- ClaudeMemory::MCP::Tools
- Includes:
- Handlers::ContextHandlers, Handlers::ManagementHandlers, Handlers::QueryHandlers, Handlers::SetupHandlers, Handlers::ShortcutHandlers, Handlers::StatsHandlers, ToolHelpers
- Defined in:
- lib/claude_memory/mcp/tools.rb
Overview
Dispatcher that routes MCP tool calls to handler modules. Each handler module (QueryHandlers, ShortcutHandlers, etc.) provides the implementation for a group of related tools.
Constant Summary collapse
- RECALL_TOOLS =
Tools that represent recall/query usage - tracked for efficacy
%w[ memory.recall memory.recall_index memory.recall_semantic memory.search_concepts memory.decisions memory.conventions memory.architecture ].freeze
- WRITE_TOOLS =
Write tools worth tracking
%w[memory.store_extraction].freeze
- TRACKED_TOOLS =
(RECALL_TOOLS + WRITE_TOOLS).freeze
Instance Method Summary collapse
-
#call(name, arguments) ⇒ Hash
Dispatch a tool call to the appropriate handler method.
-
#definitions ⇒ Array<Hash>
MCP tool definition hashes for tools/list.
-
#initialize(store_or_manager) ⇒ Tools
constructor
A new instance of Tools.
Methods included from Handlers::SetupHandlers
Methods included from Handlers::StatsHandlers
Methods included from Handlers::ManagementHandlers
#changes, #conflicts, #mark_distilled, #promote, #reject_fact, #store_extraction, #sweep_now
Methods included from Handlers::ContextHandlers
#facts_by_context, #facts_by_tool
Methods included from Handlers::ShortcutHandlers
#architecture, #conventions, #decisions
Methods included from Handlers::QueryHandlers
#explain, #fact_graph, #recall, #recall_details, #recall_index, #recall_semantic, #search_concepts, #undistilled
Methods included from ToolHelpers
#collect_undistilled_items, #extract_intent, #extract_limit, #extract_scope, #find_store_for_content_item, #format_fact, #format_receipt, #format_result
Constructor Details
#initialize(store_or_manager) ⇒ Tools
Returns a new instance of Tools.
32 33 34 35 36 37 38 39 40 |
# File 'lib/claude_memory/mcp/tools.rb', line 32 def initialize(store_or_manager) @recall = Recall.new(store_or_manager) if store_or_manager.is_a?(Store::StoreManager) @manager = store_or_manager else @legacy_store = store_or_manager end end |
Instance Method Details
#call(name, arguments) ⇒ Hash
Dispatch a tool call to the appropriate handler method.
62 63 64 65 66 67 68 69 70 |
# File 'lib/claude_memory/mcp/tools.rb', line 62 def call(name, arguments) t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = dispatch(name, arguments) log_tool_activity(name, arguments, result, t0) if TRACKED_TOOLS.include?(name) result end |
#definitions ⇒ Array<Hash>
Returns MCP tool definition hashes for tools/list.
43 44 45 |
# File 'lib/claude_memory/mcp/tools.rb', line 43 def definitions ToolDefinitions.all end |