Class: ClaudeMemory::MCP::Tools

Inherits:
Object
  • Object
show all
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.

Instance Method Summary collapse

Methods included from Handlers::SetupHandlers

#check_setup, #list_projects

Methods included from Handlers::StatsHandlers

#stats, #status

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.

Parameters:



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.

Parameters:

  • name (String)

    fully-qualified tool name (e.g. “memory.recall”)

  • arguments (Hash)

    tool arguments from the MCP request

Returns:

  • (Hash)

    structured result hash for the tool response



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/claude_memory/mcp/tools.rb', line 51

def call(name, arguments)
  case name
  when "memory.recall" then recall(arguments)
  when "memory.recall_index" then recall_index(arguments)
  when "memory.recall_details" then recall_details(arguments)
  when "memory.explain" then explain(arguments)
  when "memory.changes" then changes(arguments)
  when "memory.conflicts" then conflicts(arguments)
  when "memory.sweep_now" then sweep_now(arguments)
  when "memory.status" then status
  when "memory.stats" then stats(arguments)
  when "memory.promote" then promote(arguments)
  when "memory.reject_fact" then reject_fact(arguments)
  when "memory.store_extraction" then store_extraction(arguments)
  when "memory.decisions" then decisions(arguments)
  when "memory.conventions" then conventions(arguments)
  when "memory.architecture" then architecture(arguments)
  when "memory.facts_by_tool" then facts_by_tool(arguments)
  when "memory.facts_by_context" then facts_by_context(arguments)
  when "memory.recall_semantic" then recall_semantic(arguments)
  when "memory.search_concepts" then search_concepts(arguments)
  when "memory.fact_graph" then fact_graph(arguments)
  when "memory.undistilled" then undistilled(arguments)
  when "memory.mark_distilled" then mark_distilled(arguments)
  when "memory.check_setup" then check_setup
  when "memory.list_projects" then list_projects
  else {error: "Unknown tool: #{name}"}
  end
end

#definitionsArray<Hash>

Returns MCP tool definition hashes for tools/list.

Returns:

  • (Array<Hash>)

    MCP tool definition hashes for tools/list



43
44
45
# File 'lib/claude_memory/mcp/tools.rb', line 43

def definitions
  ToolDefinitions.all
end