Class: GemCP::Tools::SearchGems

Inherits:
Base
  • Object
show all
Defined in:
lib/gemcp/tools/search_gems.rb

Overview

Search for gems by name or description. Prefers local results when available.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from GemCP::Tools::Base

Instance Method Details

#call(query:, limit: 10) ⇒ Hash

Returns MCP response.

Parameters:

  • query (String)

    search text

  • limit (Integer) (defaults to: 10)

    maximum results to return

Returns:

  • (Hash)

    MCP response



18
19
20
21
22
23
24
# File 'lib/gemcp/tools/search_gems.rb', line 18

def call(query:, limit: 10)
  result = with_errors do
    results = client.search(query).first(limit)
    { query: query, count: results.length, gems: results }
  end
  render(result)
end