@monadsag/productive-mcp 1.2.48
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/LICENSE +190 -0
- package/NOTICE +6 -0
- package/README.md +353 -0
- package/build/api/bookings-client.js +249 -0
- package/build/api/capacity.js +279 -0
- package/build/api/client.js +1296 -0
- package/build/api/errors.js +50 -0
- package/build/api/invoice-time-entries.js +256 -0
- package/build/api/pages-tree.js +106 -0
- package/build/api/time-entry-notes.js +75 -0
- package/build/api/types.js +1 -0
- package/build/auth/logo.js +21 -0
- package/build/auth/self-resolver.js +61 -0
- package/build/config/index.js +24 -0
- package/build/index.js +15 -0
- package/build/prompts/timesheet.js +285 -0
- package/build/server.js +55 -0
- package/build/tools/absences.js +502 -0
- package/build/tools/activities.js +140 -0
- package/build/tools/bookings.js +531 -0
- package/build/tools/budget-services.js +168 -0
- package/build/tools/budgets.js +276 -0
- package/build/tools/capacity.js +281 -0
- package/build/tools/changeset.js +41 -0
- package/build/tools/comments.js +469 -0
- package/build/tools/companies.js +73 -0
- package/build/tools/custom-field-resolver.js +92 -0
- package/build/tools/custom-fields.js +155 -0
- package/build/tools/folders.js +516 -0
- package/build/tools/include-resolver.js +45 -0
- package/build/tools/invoice-actions.js +476 -0
- package/build/tools/invoice-defaults.js +65 -0
- package/build/tools/invoice-time-entries.js +320 -0
- package/build/tools/invoices.js +657 -0
- package/build/tools/my-tasks.js +100 -0
- package/build/tools/page-children.js +129 -0
- package/build/tools/pages.js +466 -0
- package/build/tools/people.js +147 -0
- package/build/tools/projects.js +77 -0
- package/build/tools/recent-updates.js +112 -0
- package/build/tools/registry.js +409 -0
- package/build/tools/subtasks.js +245 -0
- package/build/tools/task-backlog.js +106 -0
- package/build/tools/task-dependencies.js +244 -0
- package/build/tools/task-list-move.js +65 -0
- package/build/tools/task-lists.js +535 -0
- package/build/tools/task-reposition.js +199 -0
- package/build/tools/task-status.js +178 -0
- package/build/tools/tasks.js +738 -0
- package/build/tools/time-entries.js +736 -0
- package/build/tools/time-entry-approval.js +103 -0
- package/build/tools/time-entry-delete.js +72 -0
- package/build/tools/time-entry-update.js +126 -0
- package/build/tools/timers.js +195 -0
- package/build/tools/todos.js +342 -0
- package/build/tools/tool-helpers.js +114 -0
- package/build/tools/toolsets.js +153 -0
- package/build/tools/whoami.js +64 -0
- package/build/tools/workflow-statuses.js +81 -0
- package/build/utils/errors.js +67 -0
- package/build/utils/mentions.js +98 -0
- package/npm-shrinkwrap.json +1159 -0
- package/package.json +79 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { toMcpError } from '../utils/errors.js';
|
|
3
|
+
const listCustomFieldsSchema = z.object({
|
|
4
|
+
name: z.string().optional(),
|
|
5
|
+
project_id: z.string().optional(),
|
|
6
|
+
customizable_type: z.string().optional(),
|
|
7
|
+
archived: z.boolean().optional(),
|
|
8
|
+
global: z.boolean().optional(),
|
|
9
|
+
});
|
|
10
|
+
export async function listCustomFieldsTool(client, args) {
|
|
11
|
+
try {
|
|
12
|
+
const params = listCustomFieldsSchema.parse(args || {});
|
|
13
|
+
const response = await client.listCustomFields({
|
|
14
|
+
name: params.name,
|
|
15
|
+
projectId: params.project_id,
|
|
16
|
+
customizableType: params.customizable_type,
|
|
17
|
+
archived: params.archived,
|
|
18
|
+
global: params.global,
|
|
19
|
+
});
|
|
20
|
+
if (!response || !response.data || response.data.length === 0) {
|
|
21
|
+
return {
|
|
22
|
+
content: [
|
|
23
|
+
{
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: 'No custom fields found.',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const fieldsText = response.data
|
|
31
|
+
.filter((field) => field && field.attributes)
|
|
32
|
+
.map((field) => {
|
|
33
|
+
let line = `- ${field.attributes.name} (ID: ${field.id})`;
|
|
34
|
+
if (field.attributes.data_type_id !== undefined && field.attributes.data_type_id !== null) {
|
|
35
|
+
line += `\n Data type ID: ${field.attributes.data_type_id}`;
|
|
36
|
+
}
|
|
37
|
+
if (field.attributes.customizable_type) {
|
|
38
|
+
line += `\n Applies to: ${field.attributes.customizable_type}`;
|
|
39
|
+
}
|
|
40
|
+
line += `\n Raw attributes: ${JSON.stringify(field.attributes)}`;
|
|
41
|
+
return line;
|
|
42
|
+
})
|
|
43
|
+
.join('\n\n');
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: 'text',
|
|
48
|
+
text: `Found ${response.data.length} custom field${response.data.length !== 1 ? 's' : ''}:\n\n${fieldsText}`,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw toMcpError(error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export const listCustomFieldsDefinition = {
|
|
58
|
+
name: 'list_custom_fields',
|
|
59
|
+
description: 'Step 1 of working with custom fields: discover the custom fields defined in Productive.io ' +
|
|
60
|
+
'(e.g. for tasks) and their field IDs. For dropdown/multi-select fields, follow up with ' +
|
|
61
|
+
'list_custom_field_options to get the valid option IDs. The field ID (and any option IDs) then ' +
|
|
62
|
+
'feed the custom_fields object of create_task / update_task. NOTE: the generated OpenAPI spec for ' +
|
|
63
|
+
'the custom_fields resource does not document exact attribute names, so this tool renders the full ' +
|
|
64
|
+
'raw attributes defensively alongside the commonly expected ones.',
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: 'object',
|
|
67
|
+
properties: {
|
|
68
|
+
name: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
description: 'Filter by (partial) custom field name.',
|
|
71
|
+
},
|
|
72
|
+
project_id: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Filter by the project the custom field is scoped to.',
|
|
75
|
+
},
|
|
76
|
+
customizable_type: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'Filter by the entity type the field applies to. Values are lowercase plural, e.g. ' +
|
|
79
|
+
'"tasks" (not "Task"). Used to find valid custom_field IDs for a given entity before ' +
|
|
80
|
+
'calling create_task / update_task.',
|
|
81
|
+
},
|
|
82
|
+
archived: {
|
|
83
|
+
type: 'boolean',
|
|
84
|
+
description: 'Filter by archived status.',
|
|
85
|
+
},
|
|
86
|
+
global: {
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
description: 'Filter by whether the field is global (applies across all projects).',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
annotations: { title: 'List custom fields', readOnlyHint: true, openWorldHint: true },
|
|
93
|
+
};
|
|
94
|
+
const listCustomFieldOptionsSchema = z.object({
|
|
95
|
+
custom_field_id: z.string().min(1, 'custom_field_id is required'),
|
|
96
|
+
archived: z.boolean().optional(),
|
|
97
|
+
});
|
|
98
|
+
export async function listCustomFieldOptionsTool(client, args) {
|
|
99
|
+
try {
|
|
100
|
+
const params = listCustomFieldOptionsSchema.parse(args);
|
|
101
|
+
const response = await client.listCustomFieldOptions({
|
|
102
|
+
customFieldId: params.custom_field_id,
|
|
103
|
+
archived: params.archived,
|
|
104
|
+
});
|
|
105
|
+
if (!response || !response.data || response.data.length === 0) {
|
|
106
|
+
return {
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
109
|
+
type: 'text',
|
|
110
|
+
text: `No custom field options found for custom field ${params.custom_field_id}.`,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const optionsText = response.data
|
|
116
|
+
.filter((option) => option && option.attributes)
|
|
117
|
+
.map((option) => {
|
|
118
|
+
const label = option.attributes.name ?? JSON.stringify(option.attributes);
|
|
119
|
+
return `- ${label} (ID: ${option.id})`;
|
|
120
|
+
})
|
|
121
|
+
.join('\n');
|
|
122
|
+
return {
|
|
123
|
+
content: [
|
|
124
|
+
{
|
|
125
|
+
type: 'text',
|
|
126
|
+
text: `Found ${response.data.length} option${response.data.length !== 1 ? 's' : ''} for custom field ${params.custom_field_id}:\n\n${optionsText}`,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
throw toMcpError(error);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
export const listCustomFieldOptionsDefinition = {
|
|
136
|
+
name: 'list_custom_field_options',
|
|
137
|
+
description: 'Step 2 of working with custom fields: after list_custom_fields (step 1) gives you a field ID, ' +
|
|
138
|
+
'discover the valid options (e.g. dropdown/multi-select choices) and their option IDs for that ' +
|
|
139
|
+
'field. Pass those option IDs in the custom_fields object of create_task / update_task.',
|
|
140
|
+
inputSchema: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
custom_field_id: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
description: 'ID of the custom field to list options for (from list_custom_fields).',
|
|
146
|
+
},
|
|
147
|
+
archived: {
|
|
148
|
+
type: 'boolean',
|
|
149
|
+
description: 'Filter by archived status.',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
required: ['custom_field_id'],
|
|
153
|
+
},
|
|
154
|
+
annotations: { title: 'List custom field options', readOnlyHint: true, openWorldHint: true },
|
|
155
|
+
};
|
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { toMcpError } from '../utils/errors.js';
|
|
3
|
+
// Productive's UI calls this resource a "folder"; the API resource concept is
|
|
4
|
+
// a "board" (task and task-list relationships reference it as `board`/
|
|
5
|
+
// `board_id`). This file is the ONLY tool set for it -- there is no separate
|
|
6
|
+
// "board" tool. See src/api/client.ts's Board-named methods for the client
|
|
7
|
+
// layer this file talks to.
|
|
8
|
+
// ---- List Folders ----
|
|
9
|
+
const ListFoldersSchema = z.object({
|
|
10
|
+
project_id: z
|
|
11
|
+
.string()
|
|
12
|
+
.optional()
|
|
13
|
+
.describe('Filter to Folders/Boards belonging to this project ID'),
|
|
14
|
+
status: z.coerce.number().optional().describe('Filter by status (1=active, 2=archived)'),
|
|
15
|
+
limit: z.coerce
|
|
16
|
+
.number()
|
|
17
|
+
.optional()
|
|
18
|
+
.default(30)
|
|
19
|
+
.describe('Max number of Folders/Boards to return (default 30, max 200)'),
|
|
20
|
+
});
|
|
21
|
+
export async function listFolders(client, args) {
|
|
22
|
+
try {
|
|
23
|
+
const params = ListFoldersSchema.parse(args || {});
|
|
24
|
+
const response = await client.listBoards({
|
|
25
|
+
project_id: params.project_id,
|
|
26
|
+
status: params.status,
|
|
27
|
+
limit: params.limit,
|
|
28
|
+
});
|
|
29
|
+
if (!response || !response.data || response.data.length === 0) {
|
|
30
|
+
const filterText = params.project_id ? ` for project ${params.project_id}` : '';
|
|
31
|
+
return {
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
text: `No folders found${filterText}`,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const foldersText = response.data
|
|
41
|
+
.filter((folder) => folder && folder.attributes)
|
|
42
|
+
.map((folder) => {
|
|
43
|
+
let text = `Folder: ${folder.attributes.name} (ID: ${folder.id})`;
|
|
44
|
+
if (folder.attributes.position !== undefined) {
|
|
45
|
+
text += `\nPosition: ${folder.attributes.position}`;
|
|
46
|
+
}
|
|
47
|
+
if (folder.attributes.archived_at) {
|
|
48
|
+
text += `\nArchived at: ${folder.attributes.archived_at}`;
|
|
49
|
+
}
|
|
50
|
+
if (folder.relationships?.project?.data?.id) {
|
|
51
|
+
text += `\nProject ID: ${folder.relationships.project.data.id}`;
|
|
52
|
+
}
|
|
53
|
+
return text;
|
|
54
|
+
})
|
|
55
|
+
.join('\n\n');
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: foldersText,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
throw toMcpError(error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const listFoldersTool = {
|
|
70
|
+
name: 'list_folders',
|
|
71
|
+
description: 'List Folders in a project. A Folder is Productive UI name for a Board resource -- it is NOT a Task List. Folders sit directly inside a project (Customers -> Projects -> Folders/Boards -> Task Lists -> Tasks) and contain the task lists that hold tasks. The API models this resource as a "board" (see board_id on tasks/task lists); there is no separate "board" tool. Returns up to `limit` folders (default 30, max 200); pass project_id to scope to one project.',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
project_id: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Filter to Folders/Boards belonging to this project ID',
|
|
78
|
+
},
|
|
79
|
+
status: {
|
|
80
|
+
type: 'number',
|
|
81
|
+
description: 'Filter by status (1=active, 2=archived)',
|
|
82
|
+
},
|
|
83
|
+
limit: {
|
|
84
|
+
type: 'number',
|
|
85
|
+
description: 'Max number of Folders/Boards to return (default 30, max 200)',
|
|
86
|
+
default: 30,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
annotations: { title: 'List folders', readOnlyHint: true, openWorldHint: true },
|
|
91
|
+
};
|
|
92
|
+
// ---- Get Folder ----
|
|
93
|
+
const GetFolderSchema = z.object({
|
|
94
|
+
folder_id: z.string().describe('The ID of the Folder/Board to retrieve'),
|
|
95
|
+
});
|
|
96
|
+
export async function getFolder(client, args) {
|
|
97
|
+
try {
|
|
98
|
+
const params = GetFolderSchema.parse(args || {});
|
|
99
|
+
const response = await client.getBoard(params.folder_id);
|
|
100
|
+
const folder = response.data;
|
|
101
|
+
let text = `Folder: ${folder.attributes.name} (ID: ${folder.id})`;
|
|
102
|
+
if (folder.attributes.position !== undefined) {
|
|
103
|
+
text += `\nPosition: ${folder.attributes.position}`;
|
|
104
|
+
}
|
|
105
|
+
if (folder.attributes.archived_at) {
|
|
106
|
+
text += `\nArchived at: ${folder.attributes.archived_at}`;
|
|
107
|
+
}
|
|
108
|
+
if (folder.attributes.hidden !== undefined) {
|
|
109
|
+
text += `\nHidden: ${folder.attributes.hidden}`;
|
|
110
|
+
}
|
|
111
|
+
if (folder.relationships?.project?.data?.id) {
|
|
112
|
+
text += `\nProject ID: ${folder.relationships.project.data.id}`;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
content: [
|
|
116
|
+
{
|
|
117
|
+
type: 'text',
|
|
118
|
+
text: text,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
throw toMcpError(error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
export const getFolderTool = {
|
|
128
|
+
name: 'get_folder',
|
|
129
|
+
description: 'Get full details of one Folder by ID -- name, position, archived/hidden state, timestamps, and its parent Project ID. This is a Folder, i.e. a Board resource inside a project -- NOT a Task List (use get_task_list for those). The API models this resource as a "board".',
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
folder_id: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'The ID of the Folder/Board to retrieve',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
required: ['folder_id'],
|
|
139
|
+
},
|
|
140
|
+
annotations: { title: 'Get folder', readOnlyHint: true, openWorldHint: true },
|
|
141
|
+
};
|
|
142
|
+
// ---- Create Folder ----
|
|
143
|
+
const CreateFolderSchema = z.object({
|
|
144
|
+
project_id: z
|
|
145
|
+
.string()
|
|
146
|
+
.describe('The ID of the project to create the Folder/Board in (a Folder always lives inside a project)'),
|
|
147
|
+
name: z.string().describe('Name for the new Folder/Board'),
|
|
148
|
+
});
|
|
149
|
+
export async function createFolder(client, args) {
|
|
150
|
+
try {
|
|
151
|
+
const params = CreateFolderSchema.parse(args || {});
|
|
152
|
+
const folderData = {
|
|
153
|
+
data: {
|
|
154
|
+
type: 'folders',
|
|
155
|
+
attributes: {
|
|
156
|
+
name: params.name,
|
|
157
|
+
},
|
|
158
|
+
relationships: {
|
|
159
|
+
project: {
|
|
160
|
+
data: {
|
|
161
|
+
id: params.project_id,
|
|
162
|
+
type: 'projects',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
const response = await client.createBoard(folderData);
|
|
169
|
+
let text = `Folder created successfully!\n`;
|
|
170
|
+
text += `Name: ${response.data.attributes.name} (ID: ${response.data.id})`;
|
|
171
|
+
text += `\nProject ID: ${params.project_id}`;
|
|
172
|
+
if (response.data.attributes.created_at) {
|
|
173
|
+
text += `\nCreated at: ${response.data.attributes.created_at}`;
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
content: [
|
|
177
|
+
{
|
|
178
|
+
type: 'text',
|
|
179
|
+
text: text,
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
throw toMcpError(error);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
export const createFolderTool = {
|
|
189
|
+
name: 'create_folder',
|
|
190
|
+
description: 'Create a new Folder (a Board resource) inside a project. This is a Folder/Board, NOT a Task List. It is the top drill-down step when setting up new work: create_folder -> create_task_list -> create_task. A Folder must belong to a project.',
|
|
191
|
+
inputSchema: {
|
|
192
|
+
type: 'object',
|
|
193
|
+
properties: {
|
|
194
|
+
project_id: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
description: 'The ID of the project to create the Folder/Board in (a Folder always lives inside a project)',
|
|
197
|
+
},
|
|
198
|
+
name: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
description: 'Name for the new Folder/Board',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
required: ['project_id', 'name'],
|
|
204
|
+
},
|
|
205
|
+
annotations: {
|
|
206
|
+
title: 'Create folder',
|
|
207
|
+
readOnlyHint: false,
|
|
208
|
+
destructiveHint: false,
|
|
209
|
+
idempotentHint: false,
|
|
210
|
+
openWorldHint: true,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
// ---- Update Folder ----
|
|
214
|
+
const UpdateFolderSchema = z.object({
|
|
215
|
+
folder_id: z.string().describe('The ID of the Folder/Board to update'),
|
|
216
|
+
name: z.string().optional().describe('New name for the Folder/Board'),
|
|
217
|
+
});
|
|
218
|
+
export async function updateFolder(client, args) {
|
|
219
|
+
try {
|
|
220
|
+
const params = UpdateFolderSchema.parse(args || {});
|
|
221
|
+
const folderData = {
|
|
222
|
+
data: {
|
|
223
|
+
type: 'folders',
|
|
224
|
+
id: params.folder_id,
|
|
225
|
+
attributes: {
|
|
226
|
+
...(params.name !== undefined && { name: params.name }),
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
const response = await client.updateBoard(params.folder_id, folderData);
|
|
231
|
+
let text = `Folder updated successfully!\n`;
|
|
232
|
+
text += `Name: ${response.data.attributes.name} (ID: ${response.data.id})`;
|
|
233
|
+
if (response.data.attributes.updated_at) {
|
|
234
|
+
text += `\nUpdated at: ${response.data.attributes.updated_at}`;
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
content: [
|
|
238
|
+
{
|
|
239
|
+
type: 'text',
|
|
240
|
+
text: text,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
throw toMcpError(error);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
export const updateFolderTool = {
|
|
250
|
+
name: 'update_folder',
|
|
251
|
+
description: 'Rename an existing Folder (Board) by ID. This is a Folder/Board, NOT a Task List -- use update_task_list to rename a task list.',
|
|
252
|
+
inputSchema: {
|
|
253
|
+
type: 'object',
|
|
254
|
+
properties: {
|
|
255
|
+
folder_id: {
|
|
256
|
+
type: 'string',
|
|
257
|
+
description: 'The ID of the Folder/Board to update',
|
|
258
|
+
},
|
|
259
|
+
name: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
description: 'New name for the Folder/Board',
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
required: ['folder_id'],
|
|
265
|
+
},
|
|
266
|
+
annotations: {
|
|
267
|
+
title: 'Update folder',
|
|
268
|
+
readOnlyHint: false,
|
|
269
|
+
destructiveHint: false,
|
|
270
|
+
idempotentHint: true,
|
|
271
|
+
openWorldHint: true,
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
// ---- Archive Folder ----
|
|
275
|
+
const ArchiveFolderSchema = z.object({
|
|
276
|
+
folder_id: z.string().describe('The ID of the Folder/Board to archive'),
|
|
277
|
+
});
|
|
278
|
+
export async function archiveFolder(client, args) {
|
|
279
|
+
try {
|
|
280
|
+
const params = ArchiveFolderSchema.parse(args || {});
|
|
281
|
+
await client.archiveBoard(params.folder_id);
|
|
282
|
+
return {
|
|
283
|
+
content: [
|
|
284
|
+
{
|
|
285
|
+
type: 'text',
|
|
286
|
+
text: `Folder ${params.folder_id} archived successfully.`,
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
throw toMcpError(error);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
export const archiveFolderTool = {
|
|
296
|
+
name: 'archive_folder',
|
|
297
|
+
description: 'Archive a Folder (Board) by ID: hides it and its task lists/tasks from active project views while preserving all data, so it can be brought back later with restore_folder. This is a Folder/Board, NOT a Task List -- use archive_task_list to archive a single task list.',
|
|
298
|
+
inputSchema: {
|
|
299
|
+
type: 'object',
|
|
300
|
+
properties: {
|
|
301
|
+
folder_id: {
|
|
302
|
+
type: 'string',
|
|
303
|
+
description: 'The ID of the Folder/Board to archive',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
required: ['folder_id'],
|
|
307
|
+
},
|
|
308
|
+
annotations: {
|
|
309
|
+
title: 'Archive folder',
|
|
310
|
+
readOnlyHint: false,
|
|
311
|
+
destructiveHint: true,
|
|
312
|
+
idempotentHint: true,
|
|
313
|
+
openWorldHint: true,
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
// ---- Restore Folder ----
|
|
317
|
+
const RestoreFolderSchema = z.object({
|
|
318
|
+
folder_id: z.string().describe('The ID of the archived Folder/Board to restore'),
|
|
319
|
+
});
|
|
320
|
+
export async function restoreFolder(client, args) {
|
|
321
|
+
try {
|
|
322
|
+
const params = RestoreFolderSchema.parse(args || {});
|
|
323
|
+
await client.restoreBoard(params.folder_id);
|
|
324
|
+
return {
|
|
325
|
+
content: [
|
|
326
|
+
{
|
|
327
|
+
type: 'text',
|
|
328
|
+
text: `Folder ${params.folder_id} restored successfully.`,
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
throw toMcpError(error);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
export const restoreFolderTool = {
|
|
338
|
+
name: 'restore_folder',
|
|
339
|
+
description: 'Restore a previously archived Folder (Board) by ID, bringing it and its contents back into active project views (reverses archive_folder). This is a Folder/Board, NOT a Task List -- use restore_task_list for those.',
|
|
340
|
+
inputSchema: {
|
|
341
|
+
type: 'object',
|
|
342
|
+
properties: {
|
|
343
|
+
folder_id: {
|
|
344
|
+
type: 'string',
|
|
345
|
+
description: 'The ID of the archived Folder/Board to restore',
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
required: ['folder_id'],
|
|
349
|
+
},
|
|
350
|
+
annotations: {
|
|
351
|
+
title: 'Restore folder',
|
|
352
|
+
readOnlyHint: false,
|
|
353
|
+
destructiveHint: false,
|
|
354
|
+
idempotentHint: true,
|
|
355
|
+
openWorldHint: true,
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
// ---- Copy Folder ----
|
|
359
|
+
const CopyFolderSchema = z.object({
|
|
360
|
+
name: z.string().describe('Name for the new (copied) Folder/Board'),
|
|
361
|
+
template_id: z
|
|
362
|
+
.string()
|
|
363
|
+
.describe('The ID of the source Folder/Board to copy from (used as a template)'),
|
|
364
|
+
project_id: z.string().describe('The ID of the project the new Folder/Board will be created in'),
|
|
365
|
+
});
|
|
366
|
+
export async function copyFolder(client, args) {
|
|
367
|
+
try {
|
|
368
|
+
const params = CopyFolderSchema.parse(args || {});
|
|
369
|
+
const response = await client.copyBoard({
|
|
370
|
+
name: params.name,
|
|
371
|
+
template_id: params.template_id,
|
|
372
|
+
project_id: params.project_id,
|
|
373
|
+
});
|
|
374
|
+
let text = `Folder copied successfully!\n`;
|
|
375
|
+
text += `Name: ${response.data.attributes.name} (ID: ${response.data.id})`;
|
|
376
|
+
text += `\nProject ID: ${params.project_id}`;
|
|
377
|
+
return {
|
|
378
|
+
content: [
|
|
379
|
+
{
|
|
380
|
+
type: 'text',
|
|
381
|
+
text: text,
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
catch (error) {
|
|
387
|
+
throw toMcpError(error);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
export const copyFolderTool = {
|
|
391
|
+
name: 'copy_folder',
|
|
392
|
+
description: 'Duplicate an existing Folder (Board), used as a template, into a project -- creating a new Folder with the given name. This is a Folder/Board, NOT a Task List -- use copy_task_list to copy a single task list.',
|
|
393
|
+
inputSchema: {
|
|
394
|
+
type: 'object',
|
|
395
|
+
properties: {
|
|
396
|
+
name: {
|
|
397
|
+
type: 'string',
|
|
398
|
+
description: 'Name for the new (copied) Folder/Board',
|
|
399
|
+
},
|
|
400
|
+
template_id: {
|
|
401
|
+
type: 'string',
|
|
402
|
+
description: 'The ID of the source Folder/Board to copy from (used as a template)',
|
|
403
|
+
},
|
|
404
|
+
project_id: {
|
|
405
|
+
type: 'string',
|
|
406
|
+
description: 'The ID of the project the new Folder/Board will be created in',
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
required: ['name', 'template_id', 'project_id'],
|
|
410
|
+
},
|
|
411
|
+
annotations: {
|
|
412
|
+
title: 'Copy folder',
|
|
413
|
+
readOnlyHint: false,
|
|
414
|
+
destructiveHint: false,
|
|
415
|
+
idempotentHint: false,
|
|
416
|
+
openWorldHint: true,
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
// ---- Move Folder ----
|
|
420
|
+
const MoveFolderSchema = z.object({
|
|
421
|
+
folder_id: z.string().describe('The ID of the Folder/Board to move'),
|
|
422
|
+
project_id: z
|
|
423
|
+
.string()
|
|
424
|
+
.describe('The ID of the destination project to move the Folder/Board into'),
|
|
425
|
+
});
|
|
426
|
+
export async function moveFolder(client, args) {
|
|
427
|
+
try {
|
|
428
|
+
const params = MoveFolderSchema.parse(args || {});
|
|
429
|
+
await client.moveBoard(params.folder_id, params.project_id);
|
|
430
|
+
return {
|
|
431
|
+
content: [
|
|
432
|
+
{
|
|
433
|
+
type: 'text',
|
|
434
|
+
text: `Folder ${params.folder_id} moved to project ${params.project_id} successfully.`,
|
|
435
|
+
},
|
|
436
|
+
],
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
throw toMcpError(error);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
export const moveFolderTool = {
|
|
444
|
+
name: 'move_folder',
|
|
445
|
+
description: 'Move a Folder (Board), together with its task lists and tasks, to a different project. This is a Folder/Board, NOT a Task List -- use move_task_list to move a task list between folders/boards.',
|
|
446
|
+
inputSchema: {
|
|
447
|
+
type: 'object',
|
|
448
|
+
properties: {
|
|
449
|
+
folder_id: {
|
|
450
|
+
type: 'string',
|
|
451
|
+
description: 'The ID of the Folder/Board to move',
|
|
452
|
+
},
|
|
453
|
+
project_id: {
|
|
454
|
+
type: 'string',
|
|
455
|
+
description: 'The ID of the destination project to move the Folder/Board into',
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
required: ['folder_id', 'project_id'],
|
|
459
|
+
},
|
|
460
|
+
annotations: {
|
|
461
|
+
title: 'Move folder',
|
|
462
|
+
readOnlyHint: false,
|
|
463
|
+
destructiveHint: false,
|
|
464
|
+
idempotentHint: true,
|
|
465
|
+
openWorldHint: true,
|
|
466
|
+
},
|
|
467
|
+
};
|
|
468
|
+
// ---- Reposition Folder ----
|
|
469
|
+
const RepositionFolderSchema = z.object({
|
|
470
|
+
folder_id: z.string().describe('The ID of the Folder/Board to reposition'),
|
|
471
|
+
move_before_id: z
|
|
472
|
+
.string()
|
|
473
|
+
.describe('The ID of the Folder/Board to place this one immediately before'),
|
|
474
|
+
});
|
|
475
|
+
export async function repositionFolder(client, args) {
|
|
476
|
+
try {
|
|
477
|
+
const params = RepositionFolderSchema.parse(args || {});
|
|
478
|
+
await client.repositionBoard(params.folder_id, params.move_before_id);
|
|
479
|
+
return {
|
|
480
|
+
content: [
|
|
481
|
+
{
|
|
482
|
+
type: 'text',
|
|
483
|
+
text: `Folder ${params.folder_id} repositioned before ${params.move_before_id} successfully.`,
|
|
484
|
+
},
|
|
485
|
+
],
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
catch (error) {
|
|
489
|
+
throw toMcpError(error);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
export const repositionFolderTool = {
|
|
493
|
+
name: 'reposition_folder',
|
|
494
|
+
description: 'Reorder a Folder (Board) within its project by placing it immediately before another folder (changes display order only). This is a Folder/Board, NOT a Task List -- use reposition_task_list for those.',
|
|
495
|
+
inputSchema: {
|
|
496
|
+
type: 'object',
|
|
497
|
+
properties: {
|
|
498
|
+
folder_id: {
|
|
499
|
+
type: 'string',
|
|
500
|
+
description: 'The ID of the Folder/Board to reposition',
|
|
501
|
+
},
|
|
502
|
+
move_before_id: {
|
|
503
|
+
type: 'string',
|
|
504
|
+
description: 'The ID of the Folder/Board to place this one immediately before',
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
required: ['folder_id', 'move_before_id'],
|
|
508
|
+
},
|
|
509
|
+
annotations: {
|
|
510
|
+
title: 'Reposition folder',
|
|
511
|
+
readOnlyHint: false,
|
|
512
|
+
destructiveHint: false,
|
|
513
|
+
idempotentHint: true,
|
|
514
|
+
openWorldHint: true,
|
|
515
|
+
},
|
|
516
|
+
};
|