Class: LinearToonMcp::Tools::ListIssues

Inherits:
List
  • Object
show all
Defined in:
lib/linear_toon_mcp/tools/list_issues.rb

Overview

List Linear issues with optional filters and pagination. Returns TOON-encoded array with page info for cursor-based pagination.

Constant Summary collapse

QUERY =
<<~GRAPHQL
  query($filter: IssueFilter, $first: Int, $after: String, $orderBy: PaginationOrderBy, $includeArchived: Boolean) {
    issues(filter: $filter, first: $first, after: $after, orderBy: $orderBy, includeArchived: $includeArchived) {
      nodes {
        id
        identifier
        title
        priority
        priorityLabel
        url
        createdAt
        updatedAt
        state { name }
        assignee { id name }
        labels { nodes { name } }
        project { id name }
        team { id name }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
GRAPHQL
UUID_RE =
Resolvers::UUID_RE
NUMERIC_RE =
Resolvers::NUMERIC_RE

Instance Method Summary collapse

Methods inherited from List

connection, connection_name, query_string, #variables

Methods inherited from Base

call, #call, error_response, success_response

Instance Method Details

#perform(assignee: nil, createdAt: nil, cursor: nil, cycle: nil, delegate: nil, includeArchived: nil, label: nil, limit: nil, orderBy: nil, parentId: nil, priority: nil, project: nil, query: nil, state: nil, team: nil, updatedAt: nil) ⇒ Object

standard:disable Naming/VariableName



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/linear_toon_mcp/tools/list_issues.rb', line 68

def perform(assignee: nil, createdAt: nil, cursor: nil, cycle: nil,
  delegate: nil, includeArchived: nil, label: nil, limit: nil, orderBy: nil,
  parentId: nil, priority: nil, project: nil, query: nil, state: nil,
  team: nil, updatedAt: nil)
  filter = build_filter(
    assignee:, team:, project:, state:, label:,
    priority:, parentId:, cycle:, delegate:,
    query:, createdAt:, updatedAt:
  )

  variables = {
    first: (limit || 50).clamp(1, 250),
    orderBy: orderBy || "updatedAt",
    includeArchived: includeArchived != false
  }
  variables[:filter] = filter unless filter.empty?
  variables[:after] = cursor if cursor

  data = client.query(self.class.query_string, variables: variables)
  data["issues"] or raise Error, "Unexpected response: missing issues field"
end