linear-toon-mcp 2.1.2 → 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 +4 -4
- data/README.md +2 -2
- data/lib/linear_toon_mcp/tools/get_issue.rb +4 -2
- data/lib/linear_toon_mcp/tools/save_issue.rb +33 -24
- data/lib/linear_toon_mcp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb40770b09afd1288b3becc8534c210a447137467c7081617721e4d14a694f8b
|
|
4
|
+
data.tar.gz: e3c8bb66c01cec7dad15ad52dd21245d39f1f744a4a7359ca9a4b99d79b0e956
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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,
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
106
|
-
blocks: "blocks",
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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,
|
|
263
|
-
|
|
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 #{
|
|
272
|
+
raise Error, "Failed to create relation: #{from} #{relation[:type]} #{to}"
|
|
267
273
|
end
|
|
268
274
|
|
|
269
|
-
def
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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
|
|