@omnicoreos/planka-mcp 0.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.
- package/CHANGELOG.md +86 -0
- package/CONTRIBUTING.md +37 -0
- package/CREDITS.md +39 -0
- package/LICENSE +22 -0
- package/README.es.md +213 -0
- package/README.md +213 -0
- package/dist/client.d.ts +96 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +281 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +85 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +226 -0
- package/dist/errors.js.map +1 -0
- package/dist/identity.generated.d.ts +3 -0
- package/dist/identity.generated.d.ts.map +1 -0
- package/dist/identity.generated.js +4 -0
- package/dist/identity.generated.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/operations/attachments.d.ts +34 -0
- package/dist/operations/attachments.d.ts.map +1 -0
- package/dist/operations/attachments.js +89 -0
- package/dist/operations/attachments.js.map +1 -0
- package/dist/operations/board-id.d.ts +9 -0
- package/dist/operations/board-id.d.ts.map +1 -0
- package/dist/operations/board-id.js +86 -0
- package/dist/operations/board-id.js.map +1 -0
- package/dist/operations/boards.d.ts +143 -0
- package/dist/operations/boards.d.ts.map +1 -0
- package/dist/operations/boards.js +391 -0
- package/dist/operations/boards.js.map +1 -0
- package/dist/operations/cards.d.ts +36 -0
- package/dist/operations/cards.d.ts.map +1 -0
- package/dist/operations/cards.js +81 -0
- package/dist/operations/cards.js.map +1 -0
- package/dist/operations/comments.d.ts +28 -0
- package/dist/operations/comments.d.ts.map +1 -0
- package/dist/operations/comments.js +53 -0
- package/dist/operations/comments.js.map +1 -0
- package/dist/operations/labels.d.ts +60 -0
- package/dist/operations/labels.d.ts.map +1 -0
- package/dist/operations/labels.js +146 -0
- package/dist/operations/labels.js.map +1 -0
- package/dist/operations/lists.d.ts +15 -0
- package/dist/operations/lists.d.ts.map +1 -0
- package/dist/operations/lists.js +40 -0
- package/dist/operations/lists.js.map +1 -0
- package/dist/operations/projects.d.ts +24 -0
- package/dist/operations/projects.d.ts.map +1 -0
- package/dist/operations/projects.js +61 -0
- package/dist/operations/projects.js.map +1 -0
- package/dist/operations/tasks.d.ts +30 -0
- package/dist/operations/tasks.d.ts.map +1 -0
- package/dist/operations/tasks.js +111 -0
- package/dist/operations/tasks.js.map +1 -0
- package/dist/schemas/entities.d.ts +389 -0
- package/dist/schemas/entities.d.ts.map +1 -0
- package/dist/schemas/entities.js +202 -0
- package/dist/schemas/entities.js.map +1 -0
- package/dist/schemas/requests.d.ts +539 -0
- package/dist/schemas/requests.d.ts.map +1 -0
- package/dist/schemas/requests.js +187 -0
- package/dist/schemas/requests.js.map +1 -0
- package/dist/schemas/responses.d.ts +2626 -0
- package/dist/schemas/responses.d.ts.map +1 -0
- package/dist/schemas/responses.js +75 -0
- package/dist/schemas/responses.js.map +1 -0
- package/dist/tools/attachments.d.ts +270 -0
- package/dist/tools/attachments.d.ts.map +1 -0
- package/dist/tools/attachments.js +247 -0
- package/dist/tools/attachments.js.map +1 -0
- package/dist/tools/cards.d.ts +401 -0
- package/dist/tools/cards.d.ts.map +1 -0
- package/dist/tools/cards.js +368 -0
- package/dist/tools/cards.js.map +1 -0
- package/dist/tools/comments.d.ts +217 -0
- package/dist/tools/comments.d.ts.map +1 -0
- package/dist/tools/comments.js +208 -0
- package/dist/tools/comments.js.map +1 -0
- package/dist/tools/index.d.ts +1293 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +62 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/labels.d.ts +214 -0
- package/dist/tools/labels.d.ts.map +1 -0
- package/dist/tools/labels.js +302 -0
- package/dist/tools/labels.js.map +1 -0
- package/dist/tools/lists.d.ts +117 -0
- package/dist/tools/lists.d.ts.map +1 -0
- package/dist/tools/lists.js +178 -0
- package/dist/tools/lists.js.map +1 -0
- package/dist/tools/navigation.d.ts +106 -0
- package/dist/tools/navigation.d.ts.map +1 -0
- package/dist/tools/navigation.js +151 -0
- package/dist/tools/navigation.js.map +1 -0
- package/dist/tools/queries.d.ts +380 -0
- package/dist/tools/queries.d.ts.map +1 -0
- package/dist/tools/queries.js +256 -0
- package/dist/tools/queries.js.map +1 -0
- package/dist/tools/tasks.d.ts +223 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +169 -0
- package/dist/tools/tasks.js.map +1 -0
- package/docs/planka-2x-gotchas.md +192 -0
- package/docs/tools.md +659 -0
- package/docs/troubleshooting.md +138 -0
- package/package.json +71 -0
- package/project.identity.json +7 -0
- package/scripts/bootstrap-board.mjs +160 -0
- package/scripts/lib/planka-api.mjs +244 -0
- package/scripts/lib/workflow-template.mjs +26 -0
- package/scripts/setup.mjs +236 -0
- package/scripts/setup.sh +48 -0
- package/scripts/sync-identity.mjs +57 -0
- package/server.json +43 -0
- package/tests/smoke/planka-smoke.mjs +920 -0
- package/workflow/README.md +232 -0
- package/workflow/board-template.md +115 -0
- package/workflow/skills/planka-close-card/SKILL.md +81 -0
- package/workflow/skills/planka-orchestrator/SKILL.md +126 -0
- package/workflow/worktrees/README.md +104 -0
- package/workflow/worktrees/wt.conf.example +24 -0
- package/workflow/worktrees/wt.sh +345 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/schemas/responses.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC;;;;;;;;;iEAIpE,CAAC;AAEL,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC;;;;;;;;;EAInE,CAAC;AAGL,eAAO,MAAM,eAAe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;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAInB,CAAC;AAGjB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAKnB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API response schemas for PLANKA.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { ProjectSchema, BoardSchema, ListSchema, CardSchema, TaskListSchema, TaskSchema, LabelSchema, CommentSchema, UserSchema, CardLabelSchema, AttachmentSchema, } from "./entities.js";
|
|
6
|
+
// Generic response wrappers
|
|
7
|
+
export const SingleItemResponse = (itemSchema) => z.object({
|
|
8
|
+
item: itemSchema,
|
|
9
|
+
included: z.record(z.any()).optional(),
|
|
10
|
+
});
|
|
11
|
+
export const MultiItemResponse = (itemSchema) => z.object({
|
|
12
|
+
items: z.array(itemSchema),
|
|
13
|
+
included: z.record(z.any()).optional(),
|
|
14
|
+
});
|
|
15
|
+
// Specific response types
|
|
16
|
+
export const ProjectResponse = SingleItemResponse(ProjectSchema);
|
|
17
|
+
export const ProjectsResponse = MultiItemResponse(ProjectSchema);
|
|
18
|
+
export const BoardResponse = SingleItemResponse(BoardSchema);
|
|
19
|
+
export const BoardsResponse = MultiItemResponse(BoardSchema);
|
|
20
|
+
export const ListResponse = SingleItemResponse(ListSchema);
|
|
21
|
+
export const ListsResponse = MultiItemResponse(ListSchema);
|
|
22
|
+
export const CardResponse = SingleItemResponse(CardSchema);
|
|
23
|
+
export const CardsResponse = MultiItemResponse(CardSchema);
|
|
24
|
+
export const TaskListResponse = SingleItemResponse(TaskListSchema);
|
|
25
|
+
export const TaskListsResponse = MultiItemResponse(TaskListSchema);
|
|
26
|
+
export const TaskResponse = SingleItemResponse(TaskSchema);
|
|
27
|
+
export const TasksResponse = MultiItemResponse(TaskSchema);
|
|
28
|
+
export const LabelResponse = SingleItemResponse(LabelSchema);
|
|
29
|
+
export const LabelsResponse = MultiItemResponse(LabelSchema);
|
|
30
|
+
export const CommentResponse = SingleItemResponse(CommentSchema);
|
|
31
|
+
export const CommentsResponse = MultiItemResponse(CommentSchema);
|
|
32
|
+
export const CardLabelResponse = SingleItemResponse(CardLabelSchema);
|
|
33
|
+
export const AttachmentResponse = SingleItemResponse(AttachmentSchema);
|
|
34
|
+
// Auth response
|
|
35
|
+
export const AuthResponse = z.object({
|
|
36
|
+
item: z.string(), // JWT token
|
|
37
|
+
});
|
|
38
|
+
// Included entities schema for board details
|
|
39
|
+
export const BoardIncludedSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
lists: z.array(ListSchema).optional(),
|
|
42
|
+
cards: z.array(CardSchema).optional(),
|
|
43
|
+
labels: z.array(LabelSchema).optional(),
|
|
44
|
+
cardLabels: z.array(CardLabelSchema).optional(),
|
|
45
|
+
taskLists: z.array(TaskListSchema).optional(),
|
|
46
|
+
tasks: z.array(TaskSchema).optional(),
|
|
47
|
+
users: z.array(UserSchema).optional(),
|
|
48
|
+
})
|
|
49
|
+
.passthrough(); // Allow additional fields
|
|
50
|
+
// Included entities schema for card details
|
|
51
|
+
export const CardIncludedSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
taskLists: z.array(TaskListSchema).optional(),
|
|
54
|
+
tasks: z.array(TaskSchema).optional(),
|
|
55
|
+
comments: z.array(CommentSchema).optional(),
|
|
56
|
+
labels: z.array(LabelSchema).optional(),
|
|
57
|
+
cardLabels: z.array(CardLabelSchema).optional(),
|
|
58
|
+
attachments: z.array(AttachmentSchema).optional(),
|
|
59
|
+
users: z.array(UserSchema).optional(),
|
|
60
|
+
})
|
|
61
|
+
.passthrough();
|
|
62
|
+
// Included entities schema for the card-comments endpoint
|
|
63
|
+
export const CommentsIncludedSchema = z
|
|
64
|
+
.object({
|
|
65
|
+
users: z.array(UserSchema).optional(),
|
|
66
|
+
})
|
|
67
|
+
.passthrough();
|
|
68
|
+
// Projects response includes boards
|
|
69
|
+
export const ProjectsIncludedSchema = z
|
|
70
|
+
.object({
|
|
71
|
+
boards: z.array(BoardSchema).optional(),
|
|
72
|
+
users: z.array(UserSchema).optional(),
|
|
73
|
+
})
|
|
74
|
+
.passthrough();
|
|
75
|
+
//# sourceMappingURL=responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/schemas/responses.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,WAAW,EACX,aAAa,EACb,UAAU,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,4BAA4B;AAC5B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAyB,UAAa,EAAE,EAAE,CAC1E,CAAC,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAyB,UAAa,EAAE,EAAE,CACzE,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;IAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAEL,0BAA0B;AAC1B,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,C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AE;IACjD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,WAAW,EAAE,CAAC;AAEjB,0DAA0D;AAC1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,WAAW,EAAE,CAAC;AAEjB,oCAAoC;AACpC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE;IACvC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool: planka_add_attachment
|
|
3
|
+
*/
|
|
4
|
+
export declare const addAttachmentTool: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: "object";
|
|
9
|
+
properties: {
|
|
10
|
+
cardId: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
filePath: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
name: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
required: string[];
|
|
24
|
+
};
|
|
25
|
+
handler: (params: {
|
|
26
|
+
cardId: string;
|
|
27
|
+
filePath: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
}) => Promise<{
|
|
30
|
+
isError?: boolean | undefined;
|
|
31
|
+
content: {
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Tool: planka_get_attachments
|
|
39
|
+
*/
|
|
40
|
+
export declare const getAttachmentsTool: {
|
|
41
|
+
name: string;
|
|
42
|
+
description: string;
|
|
43
|
+
inputSchema: {
|
|
44
|
+
type: "object";
|
|
45
|
+
properties: {
|
|
46
|
+
cardId: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
required: string[];
|
|
52
|
+
};
|
|
53
|
+
handler: (params: {
|
|
54
|
+
cardId: string;
|
|
55
|
+
}) => Promise<{
|
|
56
|
+
content: {
|
|
57
|
+
type: "text";
|
|
58
|
+
text: string;
|
|
59
|
+
}[];
|
|
60
|
+
isError: boolean;
|
|
61
|
+
} | {
|
|
62
|
+
content: {
|
|
63
|
+
type: "text";
|
|
64
|
+
text: string;
|
|
65
|
+
}[];
|
|
66
|
+
}>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Tool: planka_view_attachment
|
|
70
|
+
* Images come back as MCP "image" content (the model actually SEES them);
|
|
71
|
+
* text comes back inline; anything else returns metadata + URL.
|
|
72
|
+
*/
|
|
73
|
+
export declare const viewAttachmentTool: {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: "object";
|
|
78
|
+
properties: {
|
|
79
|
+
cardId: {
|
|
80
|
+
type: string;
|
|
81
|
+
description: string;
|
|
82
|
+
};
|
|
83
|
+
attachmentId: {
|
|
84
|
+
type: string;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
required: string[];
|
|
89
|
+
};
|
|
90
|
+
handler: (params: {
|
|
91
|
+
cardId: string;
|
|
92
|
+
attachmentId?: string;
|
|
93
|
+
}) => Promise<{
|
|
94
|
+
content: {
|
|
95
|
+
type: "text";
|
|
96
|
+
text: string;
|
|
97
|
+
}[];
|
|
98
|
+
isError: boolean;
|
|
99
|
+
} | {
|
|
100
|
+
content: ({
|
|
101
|
+
type: "text";
|
|
102
|
+
text: string;
|
|
103
|
+
data?: undefined;
|
|
104
|
+
mimeType?: undefined;
|
|
105
|
+
} | {
|
|
106
|
+
type: "image";
|
|
107
|
+
data: string;
|
|
108
|
+
mimeType: string;
|
|
109
|
+
text?: undefined;
|
|
110
|
+
})[];
|
|
111
|
+
}>;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Tool: planka_delete_attachment
|
|
115
|
+
*/
|
|
116
|
+
export declare const deleteAttachmentTool: {
|
|
117
|
+
name: string;
|
|
118
|
+
description: string;
|
|
119
|
+
inputSchema: {
|
|
120
|
+
type: "object";
|
|
121
|
+
properties: {
|
|
122
|
+
attachmentId: {
|
|
123
|
+
type: string;
|
|
124
|
+
description: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
required: string[];
|
|
128
|
+
};
|
|
129
|
+
handler: (params: {
|
|
130
|
+
attachmentId: string;
|
|
131
|
+
}) => Promise<{
|
|
132
|
+
content: {
|
|
133
|
+
type: "text";
|
|
134
|
+
text: string;
|
|
135
|
+
}[];
|
|
136
|
+
isError: boolean;
|
|
137
|
+
} | {
|
|
138
|
+
content: {
|
|
139
|
+
type: "text";
|
|
140
|
+
text: string;
|
|
141
|
+
}[];
|
|
142
|
+
}>;
|
|
143
|
+
};
|
|
144
|
+
export declare const attachmentTools: ({
|
|
145
|
+
name: string;
|
|
146
|
+
description: string;
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object";
|
|
149
|
+
properties: {
|
|
150
|
+
cardId: {
|
|
151
|
+
type: string;
|
|
152
|
+
description: string;
|
|
153
|
+
};
|
|
154
|
+
filePath: {
|
|
155
|
+
type: string;
|
|
156
|
+
description: string;
|
|
157
|
+
};
|
|
158
|
+
name: {
|
|
159
|
+
type: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
required: string[];
|
|
164
|
+
};
|
|
165
|
+
handler: (params: {
|
|
166
|
+
cardId: string;
|
|
167
|
+
filePath: string;
|
|
168
|
+
name?: string;
|
|
169
|
+
}) => Promise<{
|
|
170
|
+
isError?: boolean | undefined;
|
|
171
|
+
content: {
|
|
172
|
+
type: "text";
|
|
173
|
+
text: string;
|
|
174
|
+
}[];
|
|
175
|
+
}>;
|
|
176
|
+
} | {
|
|
177
|
+
name: string;
|
|
178
|
+
description: string;
|
|
179
|
+
inputSchema: {
|
|
180
|
+
type: "object";
|
|
181
|
+
properties: {
|
|
182
|
+
cardId: {
|
|
183
|
+
type: string;
|
|
184
|
+
description: string;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
required: string[];
|
|
188
|
+
};
|
|
189
|
+
handler: (params: {
|
|
190
|
+
cardId: string;
|
|
191
|
+
}) => Promise<{
|
|
192
|
+
content: {
|
|
193
|
+
type: "text";
|
|
194
|
+
text: string;
|
|
195
|
+
}[];
|
|
196
|
+
isError: boolean;
|
|
197
|
+
} | {
|
|
198
|
+
content: {
|
|
199
|
+
type: "text";
|
|
200
|
+
text: string;
|
|
201
|
+
}[];
|
|
202
|
+
}>;
|
|
203
|
+
} | {
|
|
204
|
+
name: string;
|
|
205
|
+
description: string;
|
|
206
|
+
inputSchema: {
|
|
207
|
+
type: "object";
|
|
208
|
+
properties: {
|
|
209
|
+
cardId: {
|
|
210
|
+
type: string;
|
|
211
|
+
description: string;
|
|
212
|
+
};
|
|
213
|
+
attachmentId: {
|
|
214
|
+
type: string;
|
|
215
|
+
description: string;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
required: string[];
|
|
219
|
+
};
|
|
220
|
+
handler: (params: {
|
|
221
|
+
cardId: string;
|
|
222
|
+
attachmentId?: string;
|
|
223
|
+
}) => Promise<{
|
|
224
|
+
content: {
|
|
225
|
+
type: "text";
|
|
226
|
+
text: string;
|
|
227
|
+
}[];
|
|
228
|
+
isError: boolean;
|
|
229
|
+
} | {
|
|
230
|
+
content: ({
|
|
231
|
+
type: "text";
|
|
232
|
+
text: string;
|
|
233
|
+
data?: undefined;
|
|
234
|
+
mimeType?: undefined;
|
|
235
|
+
} | {
|
|
236
|
+
type: "image";
|
|
237
|
+
data: string;
|
|
238
|
+
mimeType: string;
|
|
239
|
+
text?: undefined;
|
|
240
|
+
})[];
|
|
241
|
+
}>;
|
|
242
|
+
} | {
|
|
243
|
+
name: string;
|
|
244
|
+
description: string;
|
|
245
|
+
inputSchema: {
|
|
246
|
+
type: "object";
|
|
247
|
+
properties: {
|
|
248
|
+
attachmentId: {
|
|
249
|
+
type: string;
|
|
250
|
+
description: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
required: string[];
|
|
254
|
+
};
|
|
255
|
+
handler: (params: {
|
|
256
|
+
attachmentId: string;
|
|
257
|
+
}) => Promise<{
|
|
258
|
+
content: {
|
|
259
|
+
type: "text";
|
|
260
|
+
text: string;
|
|
261
|
+
}[];
|
|
262
|
+
isError: boolean;
|
|
263
|
+
} | {
|
|
264
|
+
content: {
|
|
265
|
+
type: "text";
|
|
266
|
+
text: string;
|
|
267
|
+
}[];
|
|
268
|
+
}>;
|
|
269
|
+
})[];
|
|
270
|
+
//# sourceMappingURL=attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/tools/attachments.ts"],"names":[],"mappings":"AAqCA;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;sBAqBJ;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;;;;;;;CAqCF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;sBAWL;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;CA0B3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;sBAgBL;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;CAmFlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;sBAUP;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;CAoBjD,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;sBAlOF;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;;;;;;;;;;;;;;;;;;;;sBAqDuB;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAiDlB;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAkGzC;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;IA2BjD,CAAC"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attachment tools for PLANKA MCP server.
|
|
3
|
+
*/
|
|
4
|
+
import { getAttachmentsForCard, uploadAttachment, deleteAttachment, downloadAttachment, attachmentDownloadUrl, } from "../operations/attachments.js";
|
|
5
|
+
import { PlankaError } from "../errors.js";
|
|
6
|
+
/** Cap for returning images inline to the model (base64 inflates ~33%). */
|
|
7
|
+
const MAX_IMAGE_BYTES = 3 * 1024 * 1024;
|
|
8
|
+
/** Cap for text attachments returned inline. */
|
|
9
|
+
const MAX_TEXT_BYTES = 50 * 1024;
|
|
10
|
+
function summarize(attachment) {
|
|
11
|
+
return {
|
|
12
|
+
id: attachment.id,
|
|
13
|
+
name: attachment.name,
|
|
14
|
+
type: attachment.type,
|
|
15
|
+
mimeType: attachment.data?.mimeType ?? undefined,
|
|
16
|
+
size: attachment.data?.size ?? undefined,
|
|
17
|
+
url: attachmentDownloadUrl({ attachment }),
|
|
18
|
+
createdAt: attachment.createdAt,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function errorResult(message) {
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
24
|
+
isError: true,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Tool: planka_add_attachment
|
|
29
|
+
*/
|
|
30
|
+
export const addAttachmentTool = {
|
|
31
|
+
name: "planka_add_attachment",
|
|
32
|
+
description: "Upload a local file (screenshot, log, doc) as an attachment on a card. " +
|
|
33
|
+
"Verifies the upload by re-reading the card's attachments.",
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
cardId: { type: "string", description: "The card ID" },
|
|
38
|
+
filePath: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "Absolute path of the local file to upload",
|
|
41
|
+
},
|
|
42
|
+
name: {
|
|
43
|
+
type: "string",
|
|
44
|
+
description: "Attachment name shown in Planka (defaults to the file's basename). Use descriptive names: antes-…, despues-…, error-consola-…",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
required: ["cardId", "filePath"],
|
|
48
|
+
},
|
|
49
|
+
handler: async (params) => {
|
|
50
|
+
try {
|
|
51
|
+
const attachment = await uploadAttachment({
|
|
52
|
+
cardId: params.cardId,
|
|
53
|
+
filePath: params.filePath,
|
|
54
|
+
name: params.name,
|
|
55
|
+
});
|
|
56
|
+
// Verify by re-reading the card's attachments: Planka sometimes answers
|
|
57
|
+
// 200 without persisting, and a write is not done until a read says so.
|
|
58
|
+
const after = await getAttachmentsForCard({ cardId: params.cardId });
|
|
59
|
+
const verified = after.some((a) => a.id === attachment.id);
|
|
60
|
+
return {
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
63
|
+
type: "text",
|
|
64
|
+
text: JSON.stringify({ success: verified, verified, attachment: summarize(attachment) }, null, 2),
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
...(verified ? {} : { isError: true }),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error instanceof PlankaError)
|
|
72
|
+
return errorResult(error.message);
|
|
73
|
+
if (error instanceof Error &&
|
|
74
|
+
error.code === "ENOENT") {
|
|
75
|
+
return errorResult(`File not found: ${params.filePath}`);
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Tool: planka_get_attachments
|
|
83
|
+
*/
|
|
84
|
+
export const getAttachmentsTool = {
|
|
85
|
+
name: "planka_get_attachments",
|
|
86
|
+
description: "List the attachments on a card (id, name, mimeType, size, download URL).",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
cardId: { type: "string", description: "The card ID" },
|
|
91
|
+
},
|
|
92
|
+
required: ["cardId"],
|
|
93
|
+
},
|
|
94
|
+
handler: async (params) => {
|
|
95
|
+
try {
|
|
96
|
+
const attachments = await getAttachmentsForCard({
|
|
97
|
+
cardId: params.cardId,
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: JSON.stringify({
|
|
104
|
+
cardId: params.cardId,
|
|
105
|
+
attachmentCount: attachments.length,
|
|
106
|
+
attachments: attachments.map(summarize),
|
|
107
|
+
}, null, 2),
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error instanceof PlankaError)
|
|
114
|
+
return errorResult(error.message);
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Tool: planka_view_attachment
|
|
121
|
+
* Images come back as MCP "image" content (the model actually SEES them);
|
|
122
|
+
* text comes back inline; anything else returns metadata + URL.
|
|
123
|
+
*/
|
|
124
|
+
export const viewAttachmentTool = {
|
|
125
|
+
name: "planka_view_attachment",
|
|
126
|
+
description: "View an attachment's content. Images are returned so the model can actually see them; text files are returned inline; other types return metadata only.",
|
|
127
|
+
inputSchema: {
|
|
128
|
+
type: "object",
|
|
129
|
+
properties: {
|
|
130
|
+
cardId: { type: "string", description: "The card ID" },
|
|
131
|
+
attachmentId: {
|
|
132
|
+
type: "string",
|
|
133
|
+
description: "Attachment ID (from planka_get_attachments). If omitted and the card has exactly one attachment, that one is used.",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
required: ["cardId"],
|
|
137
|
+
},
|
|
138
|
+
handler: async (params) => {
|
|
139
|
+
try {
|
|
140
|
+
const attachments = await getAttachmentsForCard({
|
|
141
|
+
cardId: params.cardId,
|
|
142
|
+
});
|
|
143
|
+
let attachment;
|
|
144
|
+
if (params.attachmentId) {
|
|
145
|
+
attachment = attachments.find((a) => a.id === params.attachmentId);
|
|
146
|
+
if (!attachment) {
|
|
147
|
+
return errorResult(`Attachment ${params.attachmentId} not found on card ${params.cardId}. Available: ${attachments.map((a) => `${a.id} (${a.name})`).join(", ") || "none"}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else if (attachments.length === 1) {
|
|
151
|
+
attachment = attachments[0];
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
return errorResult(`Card has ${attachments.length} attachments — pass attachmentId. Available: ${attachments.map((a) => `${a.id} (${a.name})`).join(", ") || "none"}`);
|
|
155
|
+
}
|
|
156
|
+
const { bytes, mimeType } = await downloadAttachment({ attachment });
|
|
157
|
+
if (mimeType.startsWith("image/") && mimeType !== "image/svg+xml") {
|
|
158
|
+
if (bytes.byteLength > MAX_IMAGE_BYTES) {
|
|
159
|
+
return errorResult(`Image too large to view inline (${(bytes.byteLength / 1024 / 1024).toFixed(1)} MB > 3 MB). Download it instead: ${attachmentDownloadUrl({ attachment })}`);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
content: [
|
|
163
|
+
{
|
|
164
|
+
type: "text",
|
|
165
|
+
text: `Attachment "${attachment.name}" (${mimeType}, ${(bytes.byteLength / 1024).toFixed(0)} KB):`,
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: "image",
|
|
169
|
+
data: Buffer.from(bytes).toString("base64"),
|
|
170
|
+
mimeType,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
const isTexty = mimeType.startsWith("text/") ||
|
|
176
|
+
mimeType === "application/json" ||
|
|
177
|
+
mimeType === "image/svg+xml";
|
|
178
|
+
if (isTexty) {
|
|
179
|
+
const text = new TextDecoder("utf-8", { fatal: false }).decode(bytes.slice(0, MAX_TEXT_BYTES));
|
|
180
|
+
const truncated = bytes.byteLength > MAX_TEXT_BYTES;
|
|
181
|
+
return {
|
|
182
|
+
content: [
|
|
183
|
+
{
|
|
184
|
+
type: "text",
|
|
185
|
+
text: `Attachment "${attachment.name}" (${mimeType})${truncated ? " [truncated to 50KB]" : ""}:\n\n${text}`,
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
content: [
|
|
192
|
+
{
|
|
193
|
+
type: "text",
|
|
194
|
+
text: JSON.stringify({
|
|
195
|
+
message: `Binary attachment (${mimeType}) — cannot render inline`,
|
|
196
|
+
attachment: summarize(attachment),
|
|
197
|
+
}, null, 2),
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
if (error instanceof PlankaError)
|
|
204
|
+
return errorResult(error.message);
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Tool: planka_delete_attachment
|
|
211
|
+
*/
|
|
212
|
+
export const deleteAttachmentTool = {
|
|
213
|
+
name: "planka_delete_attachment",
|
|
214
|
+
description: "Delete an attachment from a card.",
|
|
215
|
+
inputSchema: {
|
|
216
|
+
type: "object",
|
|
217
|
+
properties: {
|
|
218
|
+
attachmentId: { type: "string", description: "The attachment ID" },
|
|
219
|
+
},
|
|
220
|
+
required: ["attachmentId"],
|
|
221
|
+
},
|
|
222
|
+
handler: async (params) => {
|
|
223
|
+
try {
|
|
224
|
+
await deleteAttachment({ attachmentId: params.attachmentId });
|
|
225
|
+
return {
|
|
226
|
+
content: [
|
|
227
|
+
{
|
|
228
|
+
type: "text",
|
|
229
|
+
text: JSON.stringify({ success: true, message: `Attachment ${params.attachmentId} deleted` }, null, 2),
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
if (error instanceof PlankaError)
|
|
236
|
+
return errorResult(error.message);
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
export const attachmentTools = [
|
|
242
|
+
addAttachmentTool,
|
|
243
|
+
getAttachmentsTool,
|
|
244
|
+
viewAttachmentTool,
|
|
245
|
+
deleteAttachmentTool,
|
|
246
|
+
];
|
|
247
|
+
//# sourceMappingURL=attachments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../src/tools/attachments.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,2EAA2E;AAC3E,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;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