Class: Tools::RequestFeature

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

Overview

Creates a GitHub issue via the gh CLI, letting the agent request capabilities it discovers are missing during real work. Every issue is tagged with the label from [github] label in config.toml so the developer can filter agent-originated requests from human ones.

The repository is read from [github] repo in config.toml; when unset, the tool falls back to parsing the origin remote URL.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, schema

Constructor Details

This class inherits a constructor from Tools::Base

Class Method Details

.descriptionString

Returns motivational description shown to the LLM.

Returns:

  • (String)

    motivational description shown to the LLM



20
21
22
23
# File 'lib/tools/request_feature.rb', line 20

def self.description
  "Don't have the right tool for this task? Request it! " \
    "Creates a GitHub issue so the developer knows what you need."
end

.input_schemaHash

Returns JSON Schema for the tool’s input parameters.

Returns:

  • (Hash)

    JSON Schema for the tool’s input parameters



26
27
28
29
30
31
32
33
34
35
# File 'lib/tools/request_feature.rb', line 26

def self.input_schema
  {
    type: "object",
    properties: {
      title: {type: "string", description: "Short, descriptive title for the feature request"},
      description: {type: "string", description: "What you need and why — what were you trying to do, and what's missing?"}
    },
    required: %w[title description]
  }
end

.tool_nameString

Returns tool identifier used in the Anthropic API schema.

Returns:

  • (String)

    tool identifier used in the Anthropic API schema



17
# File 'lib/tools/request_feature.rb', line 17

def self.tool_name = "request_feature"

Instance Method Details

#execute(input) ⇒ String, Hash{Symbol => String}

Parameters:

  • input (Hash<String, Object>)

    with “title” and “description” keys

Returns:

  • (String)

    formatted gh command output (stdout, stderr, and exit code if non-zero)

  • (Hash{Symbol => String})

    with :error key on validation or repo resolution failure



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/tools/request_feature.rb', line 40

def execute(input)
  title = input["title"].to_s.strip
  description = input["description"].to_s.strip
  return {error: "Title cannot be blank"} if title.empty?
  return {error: "Description cannot be blank"} if description.empty?

  repo = resolve_repo
  return repo if repo.is_a?(Hash)

  run_gh(repo, title, description)
end