linear-toon-mcp 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '00090cd861a3efd34b5e78702c34e43228ff820ae545d1802b1b8c734e37c2cc'
4
- data.tar.gz: b48d3d58fa3bac3fc6c862e15b3c56bb5bddf5314e1a6b23f862030c9338dc7f
3
+ metadata.gz: fb40770b09afd1288b3becc8534c210a447137467c7081617721e4d14a694f8b
4
+ data.tar.gz: e3c8bb66c01cec7dad15ad52dd21245d39f1f744a4a7359ca9a4b99d79b0e956
5
5
  SHA512:
6
- metadata.gz: a22dcce4a50fb1ec58e2f3df31ae5fef9cfedf412eee9e174a33a305b8a75f73068c760fe0212391e3a8b4d88d7ffea6b1526a40b4012d8b4f4b355e1c7e4411
7
- data.tar.gz: 7d54a60043cceeb31b15bfa3a89cfff63548b6b21840373f2086771f446a31540e61135a6f83a4e1dc5c06e14aeca9df9f6e576df2df9b4e74a994e33490c4ae
6
+ metadata.gz: 7103244f9f95d29dd92877ea77df037315c2d1943383fe275dad628c01cbf6af10e6006a3ea6d0cd4a713a715895f625daa73ad7d65cffdb5268944dae9df57b
7
+ data.tar.gz: f48954b1572e07dc93d68bf1a9b396b704e4c599f618054bf8c8e8a5d2ea8b12a9a529d3e59802687ca8f32cb038af05e175c45673a66461b56344a41956c7fa
data/README.md CHANGED
@@ -48,9 +48,9 @@ Most parameters accept either a UUID or a human identifier (issue identifier lik
48
48
 
49
49
  | Tool | Description |
50
50
  |------|-------------|
51
- | `get_issue` | Retrieve an issue by ID or identifier (e.g., `LIN-123`). Returns the issue plus its parent and direct children. |
51
+ | `get_issue` | Retrieve an issue by ID or identifier (e.g., `LIN-123`). Returns the issue plus its parent, direct children and relations in both directions: `relations` (what it blocks, relates to, duplicates) and `inverseRelations` (what blocks, relates to or duplicates it). |
52
52
  | `list_issues` | List issues with filters (team, assignee, creator, state, open, label, priority, project, cycle), sort by priority, and cursor pagination. |
53
- | `save_issue` | Create or update an issue. Accepts names for team, assignee, state, labels, project, cycle, and milestone. Relation params (`blocks`, `relatedTo`, `duplicateOf`) and `parentId` accept UUIDs or identifiers. On create, relations are appended; on update, they replace existing. Null clears nullable fields on update. |
53
+ | `save_issue` | Create or update an issue. Accepts names for team, assignee, state, labels, project, cycle, and milestone. Relation params (`blocks`, `blockedBy`, `relatedTo`, `duplicateOf`) and `parentId` accept UUIDs or identifiers. On create, relations are appended; on update, they replace existing ones of that kind — read them with `get_issue` first. Null clears nullable fields on update. |
54
54
 
55
55
  ### Comments
56
56
 
@@ -4,9 +4,9 @@ module LinearToonMcp
4
4
  module Tools
5
5
  # Fetch a single Linear issue by ID or identifier and return it as TOON.
6
6
  # Includes metadata, state, assignee, labels, project, team, attachments,
7
- # parent issue, and direct child issues.
7
+ # parent issue, direct child issues, and relations in both directions.
8
8
  class GetIssue < Get
9
- description "Retrieve a Linear issue by ID, including its parent and direct child issues"
9
+ description "Retrieve a Linear issue by ID, including its parent, direct child issues and relations: what it blocks, relates to or duplicates (relations) and what blocks, relates to or duplicates it (inverseRelations)"
10
10
 
11
11
  annotations(
12
12
  read_only_hint: true,
@@ -47,6 +47,8 @@ module LinearToonMcp
47
47
  attachments { nodes { id title url } }
48
48
  parent { identifier title url state { name } }
49
49
  children(first: 50) { nodes { identifier title url state { name } } }
50
+ relations(first: 50) { nodes { type relatedIssue { identifier title url state { name } } } }
51
+ inverseRelations(first: 50) { nodes { type issue { identifier title url state { name } } } }
50
52
  }
51
53
  }
52
54
  GRAPHQL
@@ -32,8 +32,9 @@ module LinearToonMcp
32
32
  estimate: {type: "number", description: "Issue estimate value"},
33
33
  dueDate: {type: "string", description: "Due date (ISO format)"},
34
34
  parentId: {type: ["string", "null"], description: "Parent issue UUID or identifier. Null to remove (update only)"},
35
- blocks: {type: "array", items: {type: "string"}, description: "Issue UUIDs or identifiers this blocks. On update, replaces existing"},
36
- relatedTo: {type: "array", items: {type: "string"}, description: "Related issue UUIDs or identifiers. On update, replaces existing"},
35
+ blocks: {type: "array", items: {type: "string"}, description: "Issue UUIDs or identifiers this blocks. On update, replaces existing; read them with get_issue first"},
36
+ blockedBy: {type: "array", items: {type: "string"}, description: "Issue UUIDs or identifiers that block this. On update, replaces existing; read them with get_issue first"},
37
+ relatedTo: {type: "array", items: {type: "string"}, description: "Related issue UUIDs or identifiers. On update, replaces existing; read them with get_issue first"},
37
38
  duplicateOf: {type: ["string", "null"], description: "Duplicate-of issue UUID or identifier. Null to remove (update only)"},
38
39
  milestone: {type: "string", description: "Milestone name or ID"},
39
40
  delegate: {type: ["string", "null"], description: "Agent name or ID. Null to remove (update only)"},
@@ -85,7 +86,8 @@ module LinearToonMcp
85
86
  RELATIONS_QUERY = <<~GRAPHQL
86
87
  query($id: String!) {
87
88
  issue(id: $id) {
88
- relations { nodes { id type relatedIssue { id } } }
89
+ relations(first: 250) { nodes { id type } pageInfo { hasNextPage } }
90
+ inverseRelations(first: 250) { nodes { id type } pageInfo { hasNextPage } }
89
91
  }
90
92
  }
91
93
  GRAPHQL
@@ -102,10 +104,11 @@ module LinearToonMcp
102
104
  }
103
105
  GRAPHQL
104
106
 
105
- RELATION_TYPE_MAP = {
106
- blocks: "blocks",
107
- relatedTo: "related",
108
- duplicateOf: "duplicate"
107
+ RELATIONS = {
108
+ blocks: {type: "blocks", stored_in: %w[relations]},
109
+ blockedBy: {type: "blocks", stored_in: %w[inverseRelations], inverse: true},
110
+ relatedTo: {type: "related", stored_in: %w[relations inverseRelations]},
111
+ duplicateOf: {type: "duplicate", stored_in: %w[relations]}
109
112
  }.freeze
110
113
 
111
114
  # standard:disable Naming/VariableName, Metrics/MethodLength
@@ -245,35 +248,41 @@ module LinearToonMcp
245
248
  end
246
249
 
247
250
  def append_relations(issue_id, kwargs)
248
- Array(kwargs[:blocks]).each { |id| create_relation(issue_id, id, "blocks") }
249
- Array(kwargs[:relatedTo]).each { |id| create_relation(issue_id, id, "related") }
250
- create_relation(issue_id, kwargs[:duplicateOf], "duplicate") if kwargs[:duplicateOf]
251
+ RELATIONS.each do |param, relation|
252
+ Array(kwargs[param]).each { |other_id| create_relation(issue_id, other_id, relation) }
253
+ end
251
254
  end
252
255
 
253
256
  def replace_relations(issue_id, kwargs)
254
- RELATION_TYPE_MAP.each do |param, type|
255
- next unless kwargs.key?(param)
256
- values = (param == :duplicateOf) ? [kwargs[param]].compact : Array(kwargs[param])
257
- delete_existing_relations(issue_id, type)
258
- values.each { |related_id| create_relation(issue_id, related_id, type) }
257
+ replaced = RELATIONS.slice(*kwargs.keys)
258
+ return if replaced.empty?
259
+
260
+ existing = client.query(RELATIONS_QUERY, variables: {id: issue_id})["issue"] || {}
261
+ replaced.each do |param, relation|
262
+ delete_relations(existing, relation)
263
+ append_relations(issue_id, kwargs.slice(param))
259
264
  end
260
265
  end
261
266
 
262
- def create_relation(issue_id, related_issue_id, type)
263
- input = {issueId: issue_id, relatedIssueId: related_issue_id, type: type}
267
+ def create_relation(issue_id, other_id, relation)
268
+ from, to = relation[:inverse] ? [other_id, issue_id] : [issue_id, other_id]
269
+ input = {issueId: from, relatedIssueId: to, type: relation[:type]}
264
270
  data = client.query(RELATION_CREATE_MUTATION, variables: {input: input})
265
271
  return if data.dig("issueRelationCreate", "success")
266
- raise Error, "Failed to create #{type} relation with #{related_issue_id}"
272
+ raise Error, "Failed to create relation: #{from} #{relation[:type]} #{to}"
267
273
  end
268
274
 
269
- def delete_existing_relations(issue_id, type)
270
- data = client.query(RELATIONS_QUERY, variables: {id: issue_id})
271
- relations = data.dig("issue", "relations", "nodes") || []
272
- relations.each do |rel|
273
- next unless rel["type"] == type
275
+ def delete_relations(existing, relation)
276
+ connections = relation[:stored_in].map { |connection| existing[connection] || {} }
277
+ if connections.any? { |connection| connection.dig("pageInfo", "hasNextPage") }
278
+ raise Error, "Cannot replace #{relation[:type]} relations: more than 250 exist"
279
+ end
280
+
281
+ connections.flat_map { |connection| connection["nodes"] || [] }.each do |rel|
282
+ next unless rel["type"] == relation[:type]
274
283
  del = client.query(RELATION_DELETE_MUTATION, variables: {id: rel["id"]})
275
284
  next if del.dig("issueRelationDelete", "success")
276
- raise Error, "Failed to delete #{type} relation #{rel["id"]}"
285
+ raise Error, "Failed to delete #{relation[:type]} relation #{rel["id"]}"
277
286
  end
278
287
  end
279
288
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LinearToonMcp
4
- VERSION = "2.1.1"
4
+ VERSION = "2.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linear-toon-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yevhenii Hurin
@@ -43,14 +43,14 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 4.3.0
46
+ version: 4.4.0
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 4.3.0
53
+ version: 4.4.0
54
54
  description: A Ruby MCP server that wraps Linear's GraphQL API and returns TOON-formatted
55
55
  responses for ~40-60% token savings in LLM workflows.
56
56
  email: