Method: VectorMCP::Definitions::Tool#handler

Defined in:
lib/vector_mcp/definitions.rb

#handlerObject

Proc A callable (e.g., a Proc or lambda) that executes the tool's logic. It receives the tool input (a Hash) as its argument. The input hash structure should match the input_schema.



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vector_mcp/definitions.rb', line 21

Tool = Struct.new(:name, :description, :input_schema, :handler) do
  # Converts the tool to its MCP definition hash.
  # @return [Hash] A hash representing the tool in MCP format.
  def as_mcp_definition
    {
      name: name,
      description: description,
      inputSchema: input_schema # Expected to be a Hash representing JSON Schema
    }.compact # Remove nil values
  end
end