Module: Reeve::Integrations::FastMcp

Defined in:
lib/reeve/integrations/fast_mcp/tool_extension.rb,
lib/reeve/integrations/fast_mcp/context_builder.rb

Overview

The fast-mcp bridge: the DSL on every tool, and the envelope around every call.

Defined Under Namespace

Modules: ContextBuilder, Inheritance, ToolExtension

Class Method Summary collapse

Class Method Details

.install!(tool_base = ::FastMcp::Tool) ⇒ Object

Idempotent: requiring "reeve/fast_mcp" twice must not stack two envelopes around the same call.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/reeve/integrations/fast_mcp/tool_extension.rb', line 39

def install!(tool_base = ::FastMcp::Tool)
  tool_base.include(Reeve::Guard) unless tool_base.include?(Reeve::Guard)

  unless tool_base.singleton_class.include?(Inheritance)
    tool_base.singleton_class.prepend(Inheritance)
  end

  # Tools defined before this require still get the envelope.
  tool_base.subclasses.each do |subclass|
    subclass.prepend(ToolExtension) unless subclass.include?(ToolExtension)
  end

  tool_base
end