Class: BundlerMCP::Tools::ListProjectGems

Inherits:
FastMcp::Tool
  • Object
show all
Defined in:
lib/bundler_mcp/tools/list_project_gems.rb

Overview

Informs the client of all bundled Ruby gems with their versions, descriptions, installation paths, documentation, and (optionally) source code locations

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection = ResourceCollection.instance) ⇒ ListProjectGems

Returns a new instance of ListProjectGems.

Parameters:

  • collection (ResourceCollection) (defaults to: ResourceCollection.instance)

    contains installed gems



26
27
28
29
# File 'lib/bundler_mcp/tools/list_project_gems.rb', line 26

def initialize(collection = ResourceCollection.instance)
  @resource_collection = collection
  super()
end

Class Method Details

.nameString

Returns Tool name exposed by FastMCP to clients.

Returns:

  • (String)

    Tool name exposed by FastMCP to clients



21
22
23
# File 'lib/bundler_mcp/tools/list_project_gems.rb', line 21

def self.name
  "list_project_gems"
end

Instance Method Details

#callArray<Hash>

Invoke the tool to list all installed gems

Returns:

  • (Array<Hash>)

    An array of hashes containing gem details



33
34
35
36
# File 'lib/bundler_mcp/tools/list_project_gems.rb', line 33

def call
  data = resource_collection.map(&:to_h)
  JSON.generate(data)
end