Class: LinearToonMcp::Tools::ListInitiatives
- Defined in:
- lib/linear_toon_mcp/tools/list_initiatives.rb
Overview
List initiatives in the Linear workspace with filtering and cursor-based pagination. Returns id, name, status, owner, parent initiative, target date, and (optionally) linked projects.
Constant Summary collapse
- BASE_FIELDS =
standard:enable Layout/LineLength
<<~GRAPHQL id name status targetDate createdAt updatedAt owner { id name } parentInitiative { id name } GRAPHQL
- PROJECTS_FIELDS =
"projects { nodes { id name } }"- UUID_RE =
Resolvers::UUID_RE
Instance Method Summary collapse
-
#perform(cursor: nil, limit: nil, orderBy: nil, query: nil, status: nil, owner: nil, parentInitiative: nil, createdAt: nil, updatedAt: nil, includeArchived: false, includeProjects: false) ⇒ Object
standard:disable Naming/VariableName.
Methods inherited from List
connection, connection_name, query_string, #variables
Methods inherited from Base
call, #call, error_response, success_response
Instance Method Details
#perform(cursor: nil, limit: nil, orderBy: nil, query: nil, status: nil, owner: nil, parentInitiative: nil, createdAt: nil, updatedAt: nil, includeArchived: false, includeProjects: false) ⇒ Object
standard:disable Naming/VariableName
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/linear_toon_mcp/tools/list_initiatives.rb', line 52 def perform(cursor: nil, limit: nil, orderBy: nil, query: nil, status: nil, owner: nil, parentInitiative: nil, createdAt: nil, updatedAt: nil, includeArchived: false, includeProjects: false) variables = { first: (limit || 50).clamp(1, 250), orderBy: orderBy || "updatedAt", includeArchived: includeArchived == true } variables[:after] = cursor if cursor filter = build_filter( query:, status:, owner:, parentInitiative:, createdAt:, updatedAt: ) variables[:filter] = filter unless filter.empty? graphql = build_query(includeProjects: includeProjects) data = client.query(graphql, variables: variables) data["initiatives"] or raise Error, "Unexpected response: missing initiatives field" end |