planko-mcp-server 0.10.0 → 0.12.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/README.md +27 -7
- package/index.js +6 -2
- package/package.json +1 -1
- package/src/api.js +26 -4
- package/src/runnerTools.js +83 -45
- package/src/tools.js +47 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ MCP server for syncing [Planko](https://planko.io) tasks with local Markdown fil
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
7
|
+
- **22 tools**: 3 folder-sync tools + 10 standalone task/note/sticky-note CRUD tools + 7 standalone read (list/view) tools + `planko_recommend_task` (suggest a task for the owner to accept or reject) + `planko_suggest_agentic_task` (suggest a task for one of the owner's agents, accepted on the Agentes page), incl. `planko_list_all` and kanban board/column filters
|
|
8
8
|
- **Type-aware sync**: each folder syncs either **tasks** (type=1) or **notes** (type=2), chosen at setup
|
|
9
9
|
- **Multi-folder**: sync multiple projects to different local folders
|
|
10
10
|
- **Bidirectional sync**: pull remote changes, push local changes
|
|
@@ -87,7 +87,7 @@ Tasks are pulled as `.md` files into your folder. Local changes are pushed back
|
|
|
87
87
|
|
|
88
88
|
## Tools
|
|
89
89
|
|
|
90
|
-
The server exposes
|
|
90
|
+
The server exposes 22 tools in four groups: **folder-sync** tools (bind a project to a local folder), **standalone CRUD** tools (create/edit/complete/delete directly via your API key, no folder needed), **standalone read** tools (list/view directly via your API key, no folder needed), and two **suggestion** tools (suggest a task, or an agentic task, that the account owner accepts or rejects).
|
|
91
91
|
|
|
92
92
|
Planko has three kinds of item, all stored as tasks with a `type`: **tasks** (`type=1`), **notes** (`type=2`) and **sticky notes** (`type=3`, a task-page item with every task property). Every kind has its own create/edit/delete/view/list tool; `planko_list_all` lists the three together.
|
|
93
93
|
|
|
@@ -172,6 +172,21 @@ Notes:
|
|
|
172
172
|
- There is **no read-back**: the API has no endpoint to list recommendations or learn their outcome, and every call creates a new pending suggestion plus a new notification. Send each suggestion once; do not retry on a slow response.
|
|
173
173
|
- Under `PLANKO_PROJECT_LOCK` the suggestion always targets the locked project (see below).
|
|
174
174
|
|
|
175
|
+
### Agentic task suggestion
|
|
176
|
+
|
|
177
|
+
An agentic task is executed by one of the owner's Planko agents from an instruction. The MCP never creates, edits, completes or deletes one; it can only **suggest** one. The suggestion lands in the **Sugestão** column of the Agentes page and nothing runs until the owner accepts it there.
|
|
178
|
+
|
|
179
|
+
| Tool | Description | Key parameters |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| `planko_suggest_agentic_task` | Suggest an agentic task to the account owner | `name` (required), `instructions` (required, Markdown, up to 5500 characters once converted), `projectName` (optional), `level` (`baixo`\|`medio`\|`alto`, optional) |
|
|
182
|
+
|
|
183
|
+
Notes:
|
|
184
|
+
|
|
185
|
+
- One-off only: no subtasks and no recurrence.
|
|
186
|
+
- The executor is the **default agent of the target project**. A project without one fails with `Escolha o agente que vai executar esta tarefa`; the owner sets it in Planko.
|
|
187
|
+
- Available only to accounts with access to agentic tasks; otherwise the call fails with `403`.
|
|
188
|
+
- Under `PLANKO_PROJECT_LOCK` the suggestion always targets the locked project.
|
|
189
|
+
|
|
175
190
|
```
|
|
176
191
|
planko_recommend_task(title: "Renovar contrato Acme", datePlain: "2026-10-01", time: "14:00", priority: 1)
|
|
177
192
|
planko_recommend_task(title: "Revisar proposta", projectName: "Comercial", description: "Pontos:\n- prazo\n- valor")
|
|
@@ -322,8 +337,10 @@ Runner mode serves the agent that executes Planko **agentic tasks**. It is enabl
|
|
|
322
337
|
setting `PLANKO_RUNNER_TOKEN` to a runner token generated in the Planko app (screen
|
|
323
338
|
*Agente → Conectar agente*). A runner token:
|
|
324
339
|
|
|
325
|
-
- belongs to one user and is
|
|
326
|
-
|
|
340
|
+
- belongs to one user and is one of that user's **agents**: the runner executes the
|
|
341
|
+
user's queued agentic tasks **whose agent is this runner** (the task's executor). The
|
|
342
|
+
projects of a runner only make it the default agent suggested for those projects; they
|
|
343
|
+
do not restrict what it runs, and a task without a project runs too;
|
|
327
344
|
- is **shown once**, when it is created; Planko stores only its hash. Lost token →
|
|
328
345
|
create a new one. Revoking it stops the runner immediately and returns any task it
|
|
329
346
|
was running to the queue.
|
|
@@ -333,9 +350,12 @@ CRUD, no folder sync), all authenticated with the runner token:
|
|
|
333
350
|
|
|
334
351
|
| Tool | What it does |
|
|
335
352
|
|---|---|
|
|
336
|
-
| `planko_agent_claim` | Long-poll for the oldest queued agentic task (`waitSeconds` 0–25)
|
|
337
|
-
| `planko_agent_finish` | Report the result (Markdown) of a claimed task with the `claimSeq` returned by the claim,
|
|
338
|
-
| `planko_agent_suggest_subtask` | Suggest a subtask (name, Markdown instructions, optional `timeoutMin`) under an agentic task. The owner accepts or rejects it in the app.
|
|
353
|
+
| `planko_agent_claim` | Long-poll for the oldest queued agentic task (`waitSeconds` 0–25), or `No task available.`. Returns the back's standardized payload with the same names: `id`, `claimSeq`, `name`, `projectName`, `timeoutMin`, `description` (the task **Instrução** in Markdown, organized in Contexto/Instrução/Entrega or not), `instructions` (the agent's **basic instructions**, applied before the task instruction — the task wins on conflict; `null` when none), `context.attachments` (`attachmentId`, `name`, `size`, `mime`), `output.suggestSubtasks`, `level`, `sourceId`, `executorKind`, `availableAt`, `releaseCount`, `recentRejections` and `parentContext` (`id`, `name`, `description`). Missing fields from an older back get safe defaults (`[]`, `suggestSubtasks: true`, `null`, `executorKind: "claude_code"`, `0`). There are no "human instructions" any more. |
|
|
354
|
+
| `planko_agent_finish` | Report the result (Markdown) of a claimed task with the `claimSeq` returned by the claim, `error: true` when it failed, and an optional `runMeta` — the run summary shown to the owner (`executorKind`, `model`, `steps`, `inputTokens`, `outputTokens`, `costUsd`, `durationMs`, `queueLatencyMs`, `stoppedBy`, …; unknown keys are refused). The task goes to validation, or is concluded automatically when its recurring model does not require validation. |
|
|
355
|
+
| `planko_agent_suggest_subtask` | Suggest a subtask (name, Markdown instructions, optional `timeoutMin`) under an agentic task. The owner accepts or rejects it in the app. When it depends on a decision only the owner can make, write the question and the options in the description: the owner edits the instruction before accepting. |
|
|
356
|
+
|
|
357
|
+
**Compatibility:** against a back that does not know `runMeta` yet, `planko_agent_finish`
|
|
358
|
+
sends the result once more without it, so the task still closes (the summary is dropped).
|
|
339
359
|
|
|
340
360
|
Every error (invalid/revoked token, task outside the token's scope, stale claim) is
|
|
341
361
|
returned as a tool error carrying the HTTP status.
|
package/index.js
CHANGED
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
* planko_list_all — tasks + sticky notes + notes in one listing
|
|
18
18
|
* planko_recommend_task — suggest a task for the account owner to accept/reject
|
|
19
19
|
*
|
|
20
|
-
* Runner mode tools (PL330 agentic tasks):
|
|
21
|
-
* planko_agent_claim
|
|
20
|
+
* Runner mode tools (PL330 agentic tasks; E9/PL347 standardized contract):
|
|
21
|
+
* planko_agent_claim — the back claim payload with the same names (description, context,
|
|
22
|
+
* output, level, sourceId, executorKind, instructions, availableAt, releaseCount,
|
|
23
|
+
* recentRejections), never the owner's human instructions
|
|
24
|
+
* planko_agent_finish — result, error, claimSeq and an optional runMeta (run summary)
|
|
25
|
+
* planko_agent_suggest_subtask — a suggestion the owner accepts or rejects
|
|
22
26
|
*/
|
|
23
27
|
|
|
24
28
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -139,6 +139,14 @@ export function createApiClient({ apiKey, apiBase }) {
|
|
|
139
139
|
return request('DELETE', `/mcp-project-sync/tasks/${taskId}`);
|
|
140
140
|
},
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* POST /mcp-project-sync/agent-tasks/suggest — agentic task (type 4) born in
|
|
144
|
+
* Sugestão; it only runs after the owner accepts it in the app.
|
|
145
|
+
*/
|
|
146
|
+
async suggestAgentTask(body) {
|
|
147
|
+
return request('POST', '/mcp-project-sync/agent-tasks/suggest', body);
|
|
148
|
+
},
|
|
149
|
+
|
|
142
150
|
/**
|
|
143
151
|
* POST /mcp-project-sync/recommendations — suggest something to the API
|
|
144
152
|
* key's owner (PL274). Body { type, payload }; returns the Recommendation
|
|
@@ -185,7 +193,7 @@ export function createApiClient({ apiKey, apiBase }) {
|
|
|
185
193
|
|
|
186
194
|
/**
|
|
187
195
|
* PL330 — API client of the agentic-tasks runner, authenticated with a runner
|
|
188
|
-
* token (`pk_run_…`, per
|
|
196
|
+
* token (`pk_run_…`, per executor), never with the user API key.
|
|
189
197
|
*/
|
|
190
198
|
export function createRunnerApiClient({ runnerToken, apiBase }) {
|
|
191
199
|
const request = makeRequest({
|
|
@@ -198,9 +206,23 @@ export function createRunnerApiClient({ runnerToken, apiBase }) {
|
|
|
198
206
|
/** POST /agent/runner/claim — long-poll; { task } or { task: null } */
|
|
199
207
|
claim: (waitSec) => request('POST', '/agent/runner/claim', waitSec == null ? {} : { waitSec }),
|
|
200
208
|
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
|
|
209
|
+
/**
|
|
210
|
+
* POST /agent/runner/tasks/:taskId/finish — bound to the claim by claimSeq; optional runMeta
|
|
211
|
+
* (run summary, E9). A back older than E1a rejects the unknown key with a 400 that cites it:
|
|
212
|
+
* the finish is sent once more without runMeta so the task still closes.
|
|
213
|
+
*/
|
|
214
|
+
finish: async (taskId, { result, error, claimSeq, runMeta }) => {
|
|
215
|
+
const path = `/agent/runner/tasks/${taskId}/finish`;
|
|
216
|
+
const body = { result, error: !!error, claimSeq };
|
|
217
|
+
if (runMeta && Object.keys(runMeta).length) body.runMeta = runMeta;
|
|
218
|
+
try {
|
|
219
|
+
return await request('POST', path, body);
|
|
220
|
+
} catch (err) {
|
|
221
|
+
if (!body.runMeta || err.status !== 400 || !/runMeta/.test(err.message)) throw err;
|
|
222
|
+
delete body.runMeta;
|
|
223
|
+
return request('POST', path, body);
|
|
224
|
+
}
|
|
225
|
+
},
|
|
204
226
|
|
|
205
227
|
/** POST /agent/runner/tasks/:taskId/subtasks — suggest a subtask under an agentic task */
|
|
206
228
|
suggestSubtask: (taskId, body) => request('POST', `/agent/runner/tasks/${taskId}/subtasks`, body),
|
package/src/runnerTools.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PL330 — tools of the agentic-tasks runner (runner mode, PLANKO_RUNNER_TOKEN).
|
|
3
3
|
* Each tool maps 1:1 to a /v1/agent/runner endpoint; the backend scopes every call
|
|
4
|
-
* to the token's
|
|
4
|
+
* to the token's owner and executor (the tasks whose agent is this runner).
|
|
5
|
+
* Errors are always returned as tool errors.
|
|
6
|
+
* E9 (PL347): the claim returns the standardized payload of the back with the same
|
|
7
|
+
* names, without the owner's "human instructions" (§12.9); finish forwards runMeta.
|
|
5
8
|
*/
|
|
6
9
|
import { z } from 'zod';
|
|
7
10
|
|
|
@@ -15,6 +18,72 @@ const ANNOTATIONS = {
|
|
|
15
18
|
|
|
16
19
|
const objectId = z.string().regex(/^[a-fA-F\d]{24}$/, 'Must be a 24-character hex ObjectId');
|
|
17
20
|
|
|
21
|
+
// Whitelist of agentRunMeta (arquitetura §2.1); mirrors the back Joi. .strict(): the agent cannot invent keys.
|
|
22
|
+
const RUN_META_NUMBERS = [
|
|
23
|
+
'steps',
|
|
24
|
+
'inputTokens',
|
|
25
|
+
'outputTokens',
|
|
26
|
+
'costUsd',
|
|
27
|
+
'orFeeUsd',
|
|
28
|
+
'upstreamCostUsd',
|
|
29
|
+
'composioCalls',
|
|
30
|
+
'durationMs',
|
|
31
|
+
'queueLatencyMs',
|
|
32
|
+
'writes',
|
|
33
|
+
];
|
|
34
|
+
const STOPPED_BY = ['submitted', 'step_cap', 'timeout', 'provider_error', 'deploy', 'interrupted'];
|
|
35
|
+
const keyList = z.array(z.string().max(200)).max(50).optional();
|
|
36
|
+
|
|
37
|
+
export const runMetaSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
executorKind: z.enum(['claude_code', 'planko']).optional(),
|
|
40
|
+
model: z.string().max(100).optional(),
|
|
41
|
+
level: z.string().max(100).optional(),
|
|
42
|
+
...Object.fromEntries(RUN_META_NUMBERS.map((k) => [k, z.number().min(0).optional()])),
|
|
43
|
+
egressDomains: z.array(z.string().max(253)).max(100).optional(),
|
|
44
|
+
memory: z.object({ added: keyList, updated: keyList, removed: keyList }).strict().optional(),
|
|
45
|
+
stoppedBy: z.enum(STOPPED_BY).optional(),
|
|
46
|
+
traceId: z.string().max(200).optional(),
|
|
47
|
+
})
|
|
48
|
+
.strict();
|
|
49
|
+
|
|
50
|
+
const orNull = (v) => (v === undefined ? null : v);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Standardized claim payload (arquitetura §3): same names as the back claim, safe defaults
|
|
54
|
+
* when an older back does not send them. Never carries humanInstructions (§12.9).
|
|
55
|
+
*/
|
|
56
|
+
export function claimPayload(task) {
|
|
57
|
+
const attachments = Array.isArray(task.context?.attachments) ? task.context.attachments : [];
|
|
58
|
+
return {
|
|
59
|
+
id: task.id,
|
|
60
|
+
claimSeq: task.claimSeq,
|
|
61
|
+
name: task.name,
|
|
62
|
+
projectName: orNull(task.projectName),
|
|
63
|
+
timeoutMin: orNull(task.agentTimeoutMin),
|
|
64
|
+
description: descriptionToMarkdown(task.description),
|
|
65
|
+
context: {
|
|
66
|
+
attachments: attachments.map(({ attachmentId, name, size, mime }) => ({
|
|
67
|
+
attachmentId: String(attachmentId),
|
|
68
|
+
name: orNull(name),
|
|
69
|
+
size: orNull(size),
|
|
70
|
+
mime: orNull(mime),
|
|
71
|
+
})),
|
|
72
|
+
},
|
|
73
|
+
output: { suggestSubtasks: task.output?.suggestSubtasks !== false },
|
|
74
|
+
level: orNull(task.level),
|
|
75
|
+
sourceId: orNull(task.sourceId),
|
|
76
|
+
executorKind: task.executorKind ?? 'claude_code',
|
|
77
|
+
instructions: typeof task.instructions === 'string' && task.instructions.trim() ? task.instructions : null,
|
|
78
|
+
availableAt: orNull(task.availableAt),
|
|
79
|
+
releaseCount: Number.isInteger(task.releaseCount) ? task.releaseCount : 0,
|
|
80
|
+
recentRejections: Array.isArray(task.recentRejections) ? task.recentRejections : [],
|
|
81
|
+
parentContext: task.parent
|
|
82
|
+
? { id: task.parent.id, name: task.parent.name, description: descriptionToMarkdown(task.parent.description) }
|
|
83
|
+
: null,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
18
87
|
export function registerRunnerTools(server, { api }) {
|
|
19
88
|
// ---- planko_agent_claim ----
|
|
20
89
|
server.registerTool(
|
|
@@ -22,7 +91,9 @@ export function registerRunnerTools(server, { api }) {
|
|
|
22
91
|
{
|
|
23
92
|
title: 'Claim agentic task',
|
|
24
93
|
description:
|
|
25
|
-
'Take the oldest queued agentic task of this runner (long-poll)
|
|
94
|
+
'Take the oldest queued agentic task of this runner (long-poll), or "No task available.". Returns id, claimSeq (send it back on planko_agent_finish), name, projectName, timeoutMin, ' +
|
|
95
|
+
'description (the task instruction, Markdown), instructions (the basic instructions of this agent: apply them before the task instruction; on conflict the task wins; null when none), ' +
|
|
96
|
+
'context.attachments (files of the instruction), output.suggestSubtasks (when false, do not suggest subtasks), level, sourceId, executorKind, availableAt, releaseCount, recentRejections and parentContext.',
|
|
26
97
|
inputSchema: {
|
|
27
98
|
waitSeconds: z
|
|
28
99
|
.number()
|
|
@@ -38,24 +109,7 @@ export function registerRunnerTools(server, { api }) {
|
|
|
38
109
|
try {
|
|
39
110
|
const { task } = await api.claim(waitSeconds);
|
|
40
111
|
if (!task) return toolOk('No task available.');
|
|
41
|
-
const payload =
|
|
42
|
-
id: task.id,
|
|
43
|
-
claimSeq: task.claimSeq,
|
|
44
|
-
name: task.name,
|
|
45
|
-
projectName: task.projectName ?? null,
|
|
46
|
-
timeoutMin: task.agentTimeoutMin ?? null,
|
|
47
|
-
instructions: descriptionToMarkdown(task.description),
|
|
48
|
-
// PL331: the owner's instructions prevail over the description
|
|
49
|
-
humanInstructions: task.humanInstructions ?? null,
|
|
50
|
-
humanInstructionsLabel: task.humanInstructionsLabel ?? null,
|
|
51
|
-
parentContext: task.parent
|
|
52
|
-
? {
|
|
53
|
-
id: task.parent.id,
|
|
54
|
-
name: task.parent.name,
|
|
55
|
-
instructions: descriptionToMarkdown(task.parent.description),
|
|
56
|
-
}
|
|
57
|
-
: null,
|
|
58
|
-
};
|
|
112
|
+
const payload = claimPayload(task);
|
|
59
113
|
return toolOk(`Claimed task ${task.id}.\n\n${JSON.stringify(payload, null, 2)}`);
|
|
60
114
|
} catch (err) {
|
|
61
115
|
return toolError(`planko_agent_claim failed: ${err.message}`);
|
|
@@ -75,12 +129,15 @@ export function registerRunnerTools(server, { api }) {
|
|
|
75
129
|
claimSeq: z.number().int().min(1).describe('claimSeq returned by planko_agent_claim for this task'),
|
|
76
130
|
result: z.string().max(100000).describe('Markdown output'),
|
|
77
131
|
error: z.boolean().optional().describe('true when the task failed'),
|
|
132
|
+
runMeta: runMetaSchema.optional().describe('Run summary (cost, tokens, steps, duration…) shown to the owner'),
|
|
78
133
|
},
|
|
79
134
|
annotations: ANNOTATIONS.IDEMPOTENT_WRITE,
|
|
80
135
|
},
|
|
81
|
-
async ({ taskId, claimSeq, result, error }) => {
|
|
136
|
+
async ({ taskId, claimSeq, result, error, runMeta }) => {
|
|
82
137
|
try {
|
|
83
|
-
const
|
|
138
|
+
const body = { result, error: !!error, claimSeq };
|
|
139
|
+
if (runMeta) body.runMeta = runMeta;
|
|
140
|
+
const { task } = await api.finish(taskId, body);
|
|
84
141
|
const auto = task.agentDecision === 'auto' ? ' (auto)' : '';
|
|
85
142
|
return toolOk(`Finished task ${task.id}: ${task.agentStatus}${auto}`);
|
|
86
143
|
} catch (err) {
|
|
@@ -96,42 +153,23 @@ export function registerRunnerTools(server, { api }) {
|
|
|
96
153
|
title: 'Suggest subtask',
|
|
97
154
|
description:
|
|
98
155
|
'Suggest a subtask under an agentic task. It is created as a suggestion that the owner accepts or rejects; it never runs before being accepted. ' +
|
|
99
|
-
'
|
|
100
|
-
'the owner
|
|
101
|
-
'Detail the options in the description (e.g. "A) …, B) …, C) …, or another one") and summarize them in humanInstructionsLabel, ' +
|
|
102
|
-
'e.g. "Decidir entre A, B, C ou outro".',
|
|
156
|
+
'If it depends on a decision only the owner can make, write the question and the options in the description (e.g. "A) …, B) …, C) …, or another one"): ' +
|
|
157
|
+
'the owner edits the instruction before accepting.',
|
|
103
158
|
inputSchema: {
|
|
104
159
|
parentTaskId: objectId.describe('Id of the agentic parent task'),
|
|
105
160
|
name: z.string().min(1).max(200).describe('Subtask title'),
|
|
106
161
|
description: z.string().optional().describe('Instructions for the subtask, as Markdown'),
|
|
107
162
|
timeoutMin: z.number().int().min(1).max(1440).optional().describe('Timeout in minutes (default 60)'),
|
|
108
|
-
requireHumanInstructions: z
|
|
109
|
-
.boolean()
|
|
110
|
-
.optional()
|
|
111
|
-
.describe('true when the owner must write instructions (e.g. pick an option) before accepting'),
|
|
112
|
-
humanInstructionsLabel: z
|
|
113
|
-
.string()
|
|
114
|
-
.trim()
|
|
115
|
-
.min(1)
|
|
116
|
-
.max(200)
|
|
117
|
-
.optional()
|
|
118
|
-
.describe('Caption of the owner instructions field, e.g. "Decidir entre A, B, C ou outro". Required when requireHumanInstructions=true'),
|
|
119
163
|
},
|
|
120
164
|
annotations: ANNOTATIONS.WRITE,
|
|
121
165
|
},
|
|
122
|
-
async ({ parentTaskId, name, description, timeoutMin
|
|
123
|
-
if (requireHumanInstructions === true && !humanInstructionsLabel?.trim()) {
|
|
124
|
-
return toolError('planko_agent_suggest_subtask failed: humanInstructionsLabel is required when requireHumanInstructions is true');
|
|
125
|
-
}
|
|
166
|
+
async ({ parentTaskId, name, description, timeoutMin }) => {
|
|
126
167
|
try {
|
|
127
168
|
const body = { name, description: markdownToDescription(description) };
|
|
128
169
|
if (timeoutMin !== undefined) body.agentTimeoutMin = timeoutMin;
|
|
129
|
-
if (requireHumanInstructions !== undefined) body.requireHumanInstructions = requireHumanInstructions;
|
|
130
|
-
if (humanInstructionsLabel !== undefined) body.humanInstructionsLabel = humanInstructionsLabel;
|
|
131
170
|
if (body.description == null) delete body.description;
|
|
132
171
|
const { task } = await api.suggestSubtask(parentTaskId, body);
|
|
133
|
-
|
|
134
|
-
return toolOk(`Suggested subtask "${task.name}" (id: ${task.id}) under ${parentTaskId}: ${task.agentStatus}${needs}`);
|
|
172
|
+
return toolOk(`Suggested subtask "${task.name}" (id: ${task.id}) under ${parentTaskId}: ${task.agentStatus}`);
|
|
135
173
|
} catch (err) {
|
|
136
174
|
return toolError(`planko_agent_suggest_subtask failed: ${err.message}`);
|
|
137
175
|
}
|
package/src/tools.js
CHANGED
|
@@ -386,6 +386,53 @@ export function registerStandaloneTools(server, { api, projectLock = null, wrapH
|
|
|
386
386
|
})
|
|
387
387
|
);
|
|
388
388
|
|
|
389
|
+
// ---- planko_suggest_agentic_task ----
|
|
390
|
+
// An agentic task (type 4, run by one of the owner's agents) in Sugestão: nothing runs until the
|
|
391
|
+
// owner accepts it on the Agentes page. One-off only (no parent, no recurrence); the executor is
|
|
392
|
+
// the project's default agent. Every other agentic write stays closed to the MCP.
|
|
393
|
+
server.registerTool(
|
|
394
|
+
'planko_suggest_agentic_task',
|
|
395
|
+
{
|
|
396
|
+
title: 'Suggest agentic task',
|
|
397
|
+
description: 'Suggest an agentic task: a task that one of the owner\'s Planko agents executes from an instruction. It is created in the "Sugestão" column of the Agentes page and runs only after the owner accepts it there; nothing executes before that. One-off only (no subtasks, no recurrence). The executor is the default agent of the target project; if the project has none, the call fails and the owner must pick a default agent for it in Planko. Send each suggestion once.',
|
|
398
|
+
inputSchema: {
|
|
399
|
+
name: z.string().trim().min(1).max(200).describe('Task name (required, up to 200 characters)'),
|
|
400
|
+
instructions: z
|
|
401
|
+
.string()
|
|
402
|
+
.trim()
|
|
403
|
+
.min(1)
|
|
404
|
+
.describe('What the agent must do (required, Markdown; up to 5500 characters once converted)'),
|
|
405
|
+
projectName: z
|
|
406
|
+
.string()
|
|
407
|
+
.optional()
|
|
408
|
+
.describe('Project name (optional — omit for your default project). Its default agent executes the task'),
|
|
409
|
+
level: z
|
|
410
|
+
.enum(['baixo', 'medio', 'alto'])
|
|
411
|
+
.optional()
|
|
412
|
+
.describe('Model level for the run (optional — omit for the agent\'s default level)'),
|
|
413
|
+
},
|
|
414
|
+
annotations: ANNOTATIONS.WRITE,
|
|
415
|
+
},
|
|
416
|
+
wrapHandler('planko_suggest_agentic_task', async (params) => {
|
|
417
|
+
try {
|
|
418
|
+
const body = { name: params.name, description: markdownToDescription(params.instructions) };
|
|
419
|
+
if (params.level) body.agentLevel = params.level;
|
|
420
|
+
if (PROJECT_LOCK) {
|
|
421
|
+
body.projectId = lockProjectId(PROJECT_LOCK, undefined);
|
|
422
|
+
} else if (!isBlankValue(params.projectName)) {
|
|
423
|
+
body.projectId = await resolveProjectId(params.projectName);
|
|
424
|
+
}
|
|
425
|
+
const res = await api.suggestAgentTask(body);
|
|
426
|
+
const { id, name: savedName } = describeTask(res);
|
|
427
|
+
return toolOk(
|
|
428
|
+
`Suggested agentic task "${savedName}" (id: ${id}). It is in "Sugestão" on the Agentes page and runs only after the owner accepts it.`
|
|
429
|
+
);
|
|
430
|
+
} catch (err) {
|
|
431
|
+
return toolError(`Suggest agentic task failed: ${err.message}`);
|
|
432
|
+
}
|
|
433
|
+
})
|
|
434
|
+
);
|
|
435
|
+
|
|
389
436
|
// ---- planko_edit_task ----
|
|
390
437
|
server.registerTool(
|
|
391
438
|
'planko_edit_task',
|