Class: GemCP::Tools::Base

Inherits:
FastMcp::Tool
  • Object
show all
Defined in:
lib/gemcp/tools/base.rb

Overview

Base class for all MCP tools. Provides client injection, error handling via dry-monads, and rendering to MCP response format.

Instance Method Summary collapse

Constructor Details

#initialize(client: nil, headers: {}) ⇒ Base

Returns a new instance of Base.

Parameters:

  • client (Client, nil) (defaults to: nil)

    injected client (defaults to a new Client)

  • headers (Hash) (defaults to: {})

    request headers passed by fast_mcp at instantiation



22
23
24
25
# File 'lib/gemcp/tools/base.rb', line 22

def initialize(client: nil, headers: {})
  super(headers: headers)
  @client = client || Client.new
end