Module: ActionMCP::Client::Prompts

Included in:
Base
Defined in:
lib/action_mcp/client/prompts.rb

Instance Method Summary collapse

Instance Method Details

#get_prompt(name, arguments = {}) ⇒ String

Get a specific prompt with arguments

Parameters:

  • name (String)

    Name of the prompt to get

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

    Arguments to pass to the prompt

Returns:

  • (String)

    Request ID for tracking the request



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/action_mcp/client/prompts.rb', line 31

def get_prompt(name, arguments = {})
  request_id = SecureRandom.uuid_v7

  # Send request
  send_jsonrpc_request("prompts/get",
                       params: {
                         name: name,
                         arguments: arguments
                       },
                       id: request_id)

  # Return request ID for tracking the request
  request_id
end

#list_prompts(params = {}) ⇒ String

List all available prompts from the server

Parameters:

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

    Optional parameters for pagination

Options Hash (params):

  • :cursor (String)

    Pagination cursor for fetching next page

  • :limit (Integer)

    Maximum number of items to return

Returns:

  • (String)

    Request ID for tracking the request



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/action_mcp/client/prompts.rb', line 11

def list_prompts(params = {})
  request_id = SecureRandom.uuid_v7

  # Send request with pagination parameters if provided
  request_params = {}
  request_params[:cursor] = params[:cursor] if params[:cursor]
  request_params[:limit] = params[:limit] if params[:limit]

  send_jsonrpc_request("prompts/list",
                       params: request_params.empty? ? nil : request_params,
                       id: request_id)

  # Return request ID for tracking the request
  request_id
end