Module: CompletionKit::McpTools::Responses

Defined in:
app/services/completion_kit/mcp_tools/responses.rb

Constant Summary collapse

TOOLS =
{
  "responses_list" => {
    description: "List responses for a run",
    inputSchema: {type: "object", properties: {run_id: {type: "integer"}}, required: ["run_id"]},
    handler: :list
  },
  "responses_get" => {
    description: "Get a specific response",
    inputSchema: {
      type: "object",
      properties: {run_id: {type: "integer"}, id: {type: "integer"}},
      required: ["run_id", "id"]
    },
    handler: :get
  }
}.freeze

Class Method Summary collapse

Class Method Details

.call(name, arguments) ⇒ Object



25
26
27
28
# File 'app/services/completion_kit/mcp_tools/responses.rb', line 25

def self.call(name, arguments)
  tool = TOOLS.fetch(name)
  send(tool[:handler], arguments)
end

.definitionsObject



21
22
23
# File 'app/services/completion_kit/mcp_tools/responses.rb', line 21

def self.definitions
  TOOLS.map { |name, config| {name: name, description: config[:description], inputSchema: config[:inputSchema]} }
end

.get(args) ⇒ Object



35
36
37
38
# File 'app/services/completion_kit/mcp_tools/responses.rb', line 35

def self.get(args)
  run = Run.find(args["run_id"])
  text_result(run.responses.find(args["id"]).as_json)
end

.list(args) ⇒ Object



30
31
32
33
# File 'app/services/completion_kit/mcp_tools/responses.rb', line 30

def self.list(args)
  run = Run.find(args["run_id"])
  text_result(run.responses.includes(:reviews).map(&:as_json))
end

.text_result(data) ⇒ Object



40
41
42
# File 'app/services/completion_kit/mcp_tools/responses.rb', line 40

def self.text_result(data)
  {content: [{type: "text", text: data.to_json}]}
end