Class: LinearToonMcp::Tools::List
- Defined in:
- lib/linear_toon_mcp/tools/list.rb
Overview
Base class for list tools. Queries a top-level GraphQL connection and returns its nodes + pageInfo. The connection name derives from the class name:
ListTeams.connection_name # => "teams"
ListIssueLabels.connection_name # => "issueLabels"
Override with List.connection when the GraphQL field diverges (e.g., ListIssueStatuses → workflowStates).
Subclasses define the QUERY constant and override #variables to compute GraphQL variables from inputs.
Direct Known Subclasses
ListComments, ListCycles, ListInitiatives, ListIssueLabels, ListIssueStatuses, ListIssues, ListProjects, ListTeams, ListUsers
Class Method Summary collapse
-
.connection(name) ⇒ Object
Overrides the derived GraphQL connection name.
-
.connection_name ⇒ Object
Returns the GraphQL connection field name.
-
.query_string ⇒ Object
Returns the GraphQL query — the
QUERYconstant on the subclass.
Instance Method Summary collapse
-
#perform(**params) ⇒ Object
Queries List.query_string with #variables and extracts the connection field.
-
#variables ⇒ Object
Subclass hook.
Methods inherited from Base
call, #call, error_response, success_response
Class Method Details
.connection(name) ⇒ Object
Overrides the derived GraphQL connection name.
20 21 22 |
# File 'lib/linear_toon_mcp/tools/list.rb', line 20 def connection(name) @connection = name.to_s end |
.connection_name ⇒ Object
Returns the GraphQL connection field name.
25 26 27 |
# File 'lib/linear_toon_mcp/tools/list.rb', line 25 def connection_name @connection ||= derive_connection_name end |
.query_string ⇒ Object
Returns the GraphQL query — the QUERY constant on the subclass.
30 31 32 |
# File 'lib/linear_toon_mcp/tools/list.rb', line 30 def query_string const_get(:QUERY) end |
Instance Method Details
#perform(**params) ⇒ Object
Queries query_string with #variables and extracts the connection field.
46 47 48 49 |
# File 'lib/linear_toon_mcp/tools/list.rb', line 46 def perform(**params) data = client.query(self.class.query_string, variables: variables(**params)) data[self.class.connection_name] or raise Error, "Unexpected response: missing #{self.class.connection_name} field" end |
#variables ⇒ Object
Subclass hook. Returns the GraphQL variables hash for #perform. Defaults to no variables.
53 54 55 |
# File 'lib/linear_toon_mcp/tools/list.rb', line 53 def variables(**) {} end |