Class: ShapeupCli::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/shapeup_cli/client.rb

Defined Under Namespace

Classes: ApiError, AuthError, NotFoundError, PermissionError, RateLimitError

Constant Summary collapse

MCP_PROTOCOL_VERSION =
"2025-06-18"

Instance Method Summary collapse

Constructor Details

#initialize(host: Config.host, token: Auth.token) ⇒ Client

Returns a new instance of Client.

Raises:



13
14
15
16
17
18
# File 'lib/shapeup_cli/client.rb', line 13

def initialize(host: Config.host, token: Auth.token)
  raise AuthError, "Not authenticated" unless token
  @host = host
  @token = token
  @request_id = 0
end

Instance Method Details

#call_tool(name, **arguments) ⇒ Object

Call an MCP tool by name with arguments



31
32
33
# File 'lib/shapeup_cli/client.rb', line 31

def call_tool(name, **arguments)
  call_method("tools/call", name: name, arguments: arguments)
end

#initialize_sessionObject

Initialise the MCP session



21
22
23
# File 'lib/shapeup_cli/client.rb', line 21

def initialize_session
  call_method("initialize", protocolVersion: MCP_PROTOCOL_VERSION)
end

#list_resourcesObject

List available resources



36
37
38
# File 'lib/shapeup_cli/client.rb', line 36

def list_resources
  call_method("resources/list")
end

#list_toolsObject

List available tools (useful for –agent –help introspection)



26
27
28
# File 'lib/shapeup_cli/client.rb', line 26

def list_tools
  call_method("tools/list")
end

#read_resource(uri) ⇒ Object

Read a resource by URI



41
42
43
# File 'lib/shapeup_cli/client.rb', line 41

def read_resource(uri)
  call_method("resources/read", uri: uri)
end