mcp-sunsama 0.7.0 → 0.8.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 +18 -0
- package/CLAUDE.md +1 -1
- package/README.md +1 -1
- package/bun.lock +2 -2
- package/dist/main.js +49 -2
- package/dist/schemas.d.ts +14 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +6 -0
- package/dist/schemas.test.js +51 -1
- package/package.json +2 -2
- package/src/main.ts +60 -1
- package/src/schemas.test.ts +68 -0
- package/src/schemas.ts +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# mcp-sunsama
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6585510: feat: add update-task-planned-time tool for updating task time estimates
|
|
8
|
+
|
|
9
|
+
This adds a new MCP tool that allows users to update the planned time (time estimate) for existing tasks in Sunsama. The tool accepts a task ID and time estimate in minutes, with optional response payload limiting.
|
|
10
|
+
|
|
11
|
+
Features:
|
|
12
|
+
|
|
13
|
+
- Update task time estimates in minutes (converted to seconds for API)
|
|
14
|
+
- Support for clearing time estimates by setting to 0
|
|
15
|
+
- Comprehensive input validation and error handling
|
|
16
|
+
- Full test coverage including edge cases
|
|
17
|
+
- Documentation updates for README and CLAUDE.md
|
|
18
|
+
|
|
19
|
+
The implementation follows established patterns in the codebase and leverages the existing sunsama-api updateTaskPlannedTime method.
|
|
20
|
+
|
|
3
21
|
## 0.7.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/CLAUDE.md
CHANGED
|
@@ -127,7 +127,7 @@ Optional:
|
|
|
127
127
|
### Task Operations
|
|
128
128
|
Full CRUD support:
|
|
129
129
|
- **Read**: `get-tasks-by-day`, `get-tasks-backlog`, `get-archived-tasks`, `get-task-by-id`, `get-streams`
|
|
130
|
-
- **Write**: `create-task`, `update-task-complete`, `update-task-snooze-date`, `update-task-backlog`, `delete-task`
|
|
130
|
+
- **Write**: `create-task`, `update-task-complete`, `update-task-planned-time`, `update-task-snooze-date`, `update-task-backlog`, `delete-task`
|
|
131
131
|
|
|
132
132
|
Task read operations support response trimming. `get-tasks-by-day` includes completion filtering. `get-archived-tasks` includes enhanced pagination with hasMore flag for LLM decision-making.
|
|
133
133
|
|
package/README.md
CHANGED
|
@@ -94,6 +94,7 @@ Add this configuration to your Claude Desktop MCP settings:
|
|
|
94
94
|
- `get-archived-tasks` - Get archived tasks with pagination (includes hasMore flag for LLM context)
|
|
95
95
|
- `get-task-by-id` - Get a specific task by its ID
|
|
96
96
|
- `update-task-complete` - Mark tasks as complete
|
|
97
|
+
- `update-task-planned-time` - Update the planned time (time estimate) for tasks
|
|
97
98
|
- `update-task-snooze-date` - Reschedule tasks to different dates
|
|
98
99
|
- `update-task-backlog` - Move tasks to the backlog
|
|
99
100
|
- `delete-task` - Delete tasks permanently
|
|
@@ -141,7 +142,6 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
141
142
|
|
|
142
143
|
## Support
|
|
143
144
|
|
|
144
|
-
- [Sunsama API Documentation](https://help.sunsama.com)
|
|
145
145
|
- [sunsama-api Library](https://github.com/robertn702/sunsama-api) - The underlying API client
|
|
146
146
|
- [Model Context Protocol Documentation](https://modelcontextprotocol.io)
|
|
147
147
|
- [Issue Tracker](https://github.com/robertn702/mcp-sunsama/issues)
|
package/bun.lock
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"@types/papaparse": "^5.3.16",
|
|
8
8
|
"fastmcp": "3.3.1",
|
|
9
9
|
"papaparse": "^5.5.3",
|
|
10
|
-
"sunsama-api": "0.
|
|
10
|
+
"sunsama-api": "0.7.0",
|
|
11
11
|
"zod": "3.24.4",
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
@@ -426,7 +426,7 @@
|
|
|
426
426
|
|
|
427
427
|
"strtok3": ["strtok3@10.3.1", "", { "dependencies": { "@tokenizer/token": "^0.3.0" } }, "sha512-3JWEZM6mfix/GCJBBUrkA8p2Id2pBkyTkVCJKto55w080QBKZ+8R171fGrbiSp+yMO/u6F8/yUh7K4V9K+YCnw=="],
|
|
428
428
|
|
|
429
|
-
"sunsama-api": ["sunsama-api@0.
|
|
429
|
+
"sunsama-api": ["sunsama-api@0.7.0", "", { "dependencies": { "graphql": "^16.11.0", "graphql-tag": "^2.12.6", "tough-cookie": "^5.1.2", "tslib": "^2.8.1", "yjs": "^13.6.27", "zod": "^3.25.64" } }, "sha512-/wPvJrtE0rUftl7c+OuQdu27OYkTvd23jzcQoAUP2SilQ6QYnFeG/Fjdf6nfl/MFuz5B8mpviGJdSgqYjAkd0g=="],
|
|
430
430
|
|
|
431
431
|
"term-size": ["term-size@2.2.1", "", {}, "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg=="],
|
|
432
432
|
|
package/dist/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import { FastMCP } from "fastmcp";
|
|
|
3
3
|
import { httpStreamAuthenticator } from "./auth/http.js";
|
|
4
4
|
import { initializeStdioAuth } from "./auth/stdio.js";
|
|
5
5
|
import { getTransportConfig } from "./config/transport.js";
|
|
6
|
-
import { createTaskSchema, deleteTaskSchema, getArchivedTasksSchema, getStreamsSchema, getTaskByIdSchema, getTasksBacklogSchema, getTasksByDaySchema, getUserSchema, updateTaskBacklogSchema, updateTaskCompleteSchema, updateTaskSnoozeDateSchema } from "./schemas.js";
|
|
6
|
+
import { createTaskSchema, deleteTaskSchema, getArchivedTasksSchema, getStreamsSchema, getTaskByIdSchema, getTasksBacklogSchema, getTasksByDaySchema, getUserSchema, updateTaskBacklogSchema, updateTaskCompleteSchema, updateTaskPlannedTimeSchema, updateTaskSnoozeDateSchema } from "./schemas.js";
|
|
7
7
|
import { getSunsamaClient } from "./utils/client-resolver.js";
|
|
8
8
|
import { filterTasksByCompletion } from "./utils/task-filters.js";
|
|
9
9
|
import { trimTasksForResponse } from "./utils/task-trimmer.js";
|
|
@@ -16,7 +16,7 @@ if (transportConfig.transportType === "stdio") {
|
|
|
16
16
|
}
|
|
17
17
|
const server = new FastMCP({
|
|
18
18
|
name: "Sunsama API Server",
|
|
19
|
-
version: "0.
|
|
19
|
+
version: "0.8.0",
|
|
20
20
|
instructions: `
|
|
21
21
|
This MCP server provides access to the Sunsama API for task and project management.
|
|
22
22
|
|
|
@@ -24,6 +24,7 @@ Available tools:
|
|
|
24
24
|
- Authentication: login, logout, check authentication status
|
|
25
25
|
- User operations: get current user information
|
|
26
26
|
- Task operations: get tasks by day, get backlog tasks, get archived tasks, get task by ID
|
|
27
|
+
- Task mutations: create tasks, mark complete, delete tasks, reschedule tasks, update planned time
|
|
27
28
|
- Stream operations: get streams/channels for the user's group
|
|
28
29
|
|
|
29
30
|
Authentication is required for all operations. You can either:
|
|
@@ -521,6 +522,52 @@ server.addTool({
|
|
|
521
522
|
}
|
|
522
523
|
}
|
|
523
524
|
});
|
|
525
|
+
server.addTool({
|
|
526
|
+
name: "update-task-planned-time",
|
|
527
|
+
description: "Update the planned time (time estimate) for a task",
|
|
528
|
+
parameters: updateTaskPlannedTimeSchema,
|
|
529
|
+
execute: async (args, { session, log }) => {
|
|
530
|
+
try {
|
|
531
|
+
// Extract parameters
|
|
532
|
+
const { taskId, timeEstimateMinutes, limitResponsePayload } = args;
|
|
533
|
+
log.info("Updating task planned time", {
|
|
534
|
+
taskId: taskId,
|
|
535
|
+
timeEstimateMinutes: timeEstimateMinutes,
|
|
536
|
+
limitResponsePayload: limitResponsePayload
|
|
537
|
+
});
|
|
538
|
+
// Get the appropriate client based on transport type
|
|
539
|
+
const sunsamaClient = getSunsamaClient(session);
|
|
540
|
+
// Call sunsamaClient.updateTaskPlannedTime(taskId, timeEstimateMinutes, limitResponsePayload)
|
|
541
|
+
const result = await sunsamaClient.updateTaskPlannedTime(taskId, timeEstimateMinutes, limitResponsePayload);
|
|
542
|
+
log.info("Successfully updated task planned time", {
|
|
543
|
+
taskId: taskId,
|
|
544
|
+
timeEstimateMinutes: timeEstimateMinutes,
|
|
545
|
+
success: result.success
|
|
546
|
+
});
|
|
547
|
+
return {
|
|
548
|
+
content: [
|
|
549
|
+
{
|
|
550
|
+
type: "text",
|
|
551
|
+
text: JSON.stringify({
|
|
552
|
+
success: result.success,
|
|
553
|
+
taskId: taskId,
|
|
554
|
+
timeEstimateMinutes: timeEstimateMinutes,
|
|
555
|
+
updatedFields: result.updatedFields
|
|
556
|
+
})
|
|
557
|
+
}
|
|
558
|
+
]
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
catch (error) {
|
|
562
|
+
log.error("Failed to update task planned time", {
|
|
563
|
+
taskId: args.taskId,
|
|
564
|
+
timeEstimateMinutes: args.timeEstimateMinutes,
|
|
565
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
566
|
+
});
|
|
567
|
+
throw new Error(`Failed to update task planned time: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
});
|
|
524
571
|
// Stream Operations
|
|
525
572
|
server.addTool({
|
|
526
573
|
name: "get-streams",
|
package/dist/schemas.d.ts
CHANGED
|
@@ -128,6 +128,19 @@ export declare const updateTaskBacklogSchema: z.ZodObject<{
|
|
|
128
128
|
timezone?: string | undefined;
|
|
129
129
|
limitResponsePayload?: boolean | undefined;
|
|
130
130
|
}>;
|
|
131
|
+
export declare const updateTaskPlannedTimeSchema: z.ZodObject<{
|
|
132
|
+
taskId: z.ZodString;
|
|
133
|
+
timeEstimateMinutes: z.ZodNumber;
|
|
134
|
+
limitResponsePayload: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
taskId: string;
|
|
137
|
+
timeEstimateMinutes: number;
|
|
138
|
+
limitResponsePayload?: boolean | undefined;
|
|
139
|
+
}, {
|
|
140
|
+
taskId: string;
|
|
141
|
+
timeEstimateMinutes: number;
|
|
142
|
+
limitResponsePayload?: boolean | undefined;
|
|
143
|
+
}>;
|
|
131
144
|
/**
|
|
132
145
|
* Response Type Schemas (for validation and documentation)
|
|
133
146
|
*/
|
|
@@ -561,6 +574,7 @@ export type CreateTaskInput = z.infer<typeof createTaskSchema>;
|
|
|
561
574
|
export type UpdateTaskCompleteInput = z.infer<typeof updateTaskCompleteSchema>;
|
|
562
575
|
export type DeleteTaskInput = z.infer<typeof deleteTaskSchema>;
|
|
563
576
|
export type UpdateTaskSnoozeDateInput = z.infer<typeof updateTaskSnoozeDateSchema>;
|
|
577
|
+
export type UpdateTaskPlannedTimeInput = z.infer<typeof updateTaskPlannedTimeSchema>;
|
|
564
578
|
export type User = z.infer<typeof userSchema>;
|
|
565
579
|
export type Task = z.infer<typeof taskSchema>;
|
|
566
580
|
export type Stream = z.infer<typeof streamSchema>;
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AAGH,eAAO,MAAM,sBAAsB,+CAA6C,CAAC;AAGjF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AAGH,eAAO,MAAM,qBAAqB,gDAAe,CAAC;AAGlD,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAC;AAGH,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH;;GAEG;AAGH,eAAO,MAAM,aAAa,gDAAe,CAAC;AAE1C;;GAEG;AAGH,eAAO,MAAM,gBAAgB,gDAAe,CAAC;AAE7C;;GAEG;AAGH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS3B,CAAC;AAGH,eAAO,MAAM,wBAAwB;;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,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/schemas.js
CHANGED
|
@@ -70,6 +70,12 @@ export const updateTaskBacklogSchema = z.object({
|
|
|
70
70
|
timezone: z.string().optional().describe("Timezone string (e.g., 'America/New_York'). If not provided, uses user's default timezone"),
|
|
71
71
|
limitResponsePayload: z.boolean().optional().describe("Whether to limit the response payload size"),
|
|
72
72
|
});
|
|
73
|
+
// Update task planned time parameters
|
|
74
|
+
export const updateTaskPlannedTimeSchema = z.object({
|
|
75
|
+
taskId: z.string().min(1, "Task ID is required").describe("The ID of the task to update planned time for"),
|
|
76
|
+
timeEstimateMinutes: z.number().int().min(0).describe("Time estimate in minutes (use 0 to clear the time estimate)"),
|
|
77
|
+
limitResponsePayload: z.boolean().optional().describe("Whether to limit the response payload size"),
|
|
78
|
+
});
|
|
73
79
|
/**
|
|
74
80
|
* Response Type Schemas (for validation and documentation)
|
|
75
81
|
*/
|
package/dist/schemas.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, test, expect } from "bun:test";
|
|
2
|
-
import { completionFilterSchema, getTasksByDaySchema, getTasksBacklogSchema, getArchivedTasksSchema, getUserSchema, getStreamsSchema, createTaskSchema, updateTaskCompleteSchema, deleteTaskSchema, updateTaskSnoozeDateSchema, updateTaskBacklogSchema, userProfileSchema, groupSchema, userSchema, taskSchema, streamSchema, userResponseSchema, tasksResponseSchema, streamsResponseSchema, errorResponseSchema, } from "./schemas.js";
|
|
2
|
+
import { completionFilterSchema, getTasksByDaySchema, getTasksBacklogSchema, getArchivedTasksSchema, getUserSchema, getStreamsSchema, createTaskSchema, updateTaskCompleteSchema, deleteTaskSchema, updateTaskSnoozeDateSchema, updateTaskBacklogSchema, updateTaskPlannedTimeSchema, userProfileSchema, groupSchema, userSchema, taskSchema, streamSchema, userResponseSchema, tasksResponseSchema, streamsResponseSchema, errorResponseSchema, } from "./schemas.js";
|
|
3
3
|
describe("Tool Parameter Schemas", () => {
|
|
4
4
|
describe("completionFilterSchema", () => {
|
|
5
5
|
test("should accept valid completion filter values", () => {
|
|
@@ -202,6 +202,56 @@ describe("Tool Parameter Schemas", () => {
|
|
|
202
202
|
expect(() => updateTaskBacklogSchema.parse({})).toThrow();
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
+
describe("updateTaskPlannedTimeSchema", () => {
|
|
206
|
+
test("should accept valid task planned time input", () => {
|
|
207
|
+
const validInput = {
|
|
208
|
+
taskId: "task-123",
|
|
209
|
+
timeEstimateMinutes: 45,
|
|
210
|
+
limitResponsePayload: true,
|
|
211
|
+
};
|
|
212
|
+
expect(() => updateTaskPlannedTimeSchema.parse(validInput)).not.toThrow();
|
|
213
|
+
});
|
|
214
|
+
test("should accept minimal required input", () => {
|
|
215
|
+
const minimalInput = {
|
|
216
|
+
taskId: "task-123",
|
|
217
|
+
timeEstimateMinutes: 30
|
|
218
|
+
};
|
|
219
|
+
expect(() => updateTaskPlannedTimeSchema.parse(minimalInput)).not.toThrow();
|
|
220
|
+
});
|
|
221
|
+
test("should accept zero time estimate", () => {
|
|
222
|
+
const zeroInput = {
|
|
223
|
+
taskId: "task-123",
|
|
224
|
+
timeEstimateMinutes: 0
|
|
225
|
+
};
|
|
226
|
+
expect(() => updateTaskPlannedTimeSchema.parse(zeroInput)).not.toThrow();
|
|
227
|
+
});
|
|
228
|
+
test("should reject empty task ID", () => {
|
|
229
|
+
expect(() => updateTaskPlannedTimeSchema.parse({
|
|
230
|
+
taskId: "",
|
|
231
|
+
timeEstimateMinutes: 30
|
|
232
|
+
})).toThrow();
|
|
233
|
+
expect(() => updateTaskPlannedTimeSchema.parse({
|
|
234
|
+
timeEstimateMinutes: 30
|
|
235
|
+
})).toThrow();
|
|
236
|
+
});
|
|
237
|
+
test("should reject negative time estimate", () => {
|
|
238
|
+
expect(() => updateTaskPlannedTimeSchema.parse({
|
|
239
|
+
taskId: "task-123",
|
|
240
|
+
timeEstimateMinutes: -1
|
|
241
|
+
})).toThrow();
|
|
242
|
+
});
|
|
243
|
+
test("should reject non-integer time estimate", () => {
|
|
244
|
+
expect(() => updateTaskPlannedTimeSchema.parse({
|
|
245
|
+
taskId: "task-123",
|
|
246
|
+
timeEstimateMinutes: 30.5
|
|
247
|
+
})).toThrow();
|
|
248
|
+
});
|
|
249
|
+
test("should reject missing time estimate", () => {
|
|
250
|
+
expect(() => updateTaskPlannedTimeSchema.parse({
|
|
251
|
+
taskId: "task-123"
|
|
252
|
+
})).toThrow();
|
|
253
|
+
});
|
|
254
|
+
});
|
|
205
255
|
});
|
|
206
256
|
describe("Response Schemas", () => {
|
|
207
257
|
describe("userProfileSchema", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-sunsama",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "MCP server for Sunsama API integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@types/papaparse": "^5.3.16",
|
|
27
27
|
"fastmcp": "3.3.1",
|
|
28
28
|
"papaparse": "^5.5.3",
|
|
29
|
-
"sunsama-api": "0.
|
|
29
|
+
"sunsama-api": "0.7.0",
|
|
30
30
|
"zod": "3.24.4"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
package/src/main.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
getUserSchema,
|
|
17
17
|
updateTaskBacklogSchema,
|
|
18
18
|
updateTaskCompleteSchema,
|
|
19
|
+
updateTaskPlannedTimeSchema,
|
|
19
20
|
updateTaskSnoozeDateSchema
|
|
20
21
|
} from "./schemas.js";
|
|
21
22
|
import { getSunsamaClient } from "./utils/client-resolver.js";
|
|
@@ -33,7 +34,7 @@ if (transportConfig.transportType === "stdio") {
|
|
|
33
34
|
|
|
34
35
|
const server = new FastMCP({
|
|
35
36
|
name: "Sunsama API Server",
|
|
36
|
-
version: "0.
|
|
37
|
+
version: "0.8.0",
|
|
37
38
|
instructions: `
|
|
38
39
|
This MCP server provides access to the Sunsama API for task and project management.
|
|
39
40
|
|
|
@@ -41,6 +42,7 @@ Available tools:
|
|
|
41
42
|
- Authentication: login, logout, check authentication status
|
|
42
43
|
- User operations: get current user information
|
|
43
44
|
- Task operations: get tasks by day, get backlog tasks, get archived tasks, get task by ID
|
|
45
|
+
- Task mutations: create tasks, mark complete, delete tasks, reschedule tasks, update planned time
|
|
44
46
|
- Stream operations: get streams/channels for the user's group
|
|
45
47
|
|
|
46
48
|
Authentication is required for all operations. You can either:
|
|
@@ -630,6 +632,63 @@ server.addTool({
|
|
|
630
632
|
}
|
|
631
633
|
});
|
|
632
634
|
|
|
635
|
+
server.addTool({
|
|
636
|
+
name: "update-task-planned-time",
|
|
637
|
+
description: "Update the planned time (time estimate) for a task",
|
|
638
|
+
parameters: updateTaskPlannedTimeSchema,
|
|
639
|
+
execute: async (args, {session, log}) => {
|
|
640
|
+
try {
|
|
641
|
+
// Extract parameters
|
|
642
|
+
const {taskId, timeEstimateMinutes, limitResponsePayload} = args;
|
|
643
|
+
|
|
644
|
+
log.info("Updating task planned time", {
|
|
645
|
+
taskId: taskId,
|
|
646
|
+
timeEstimateMinutes: timeEstimateMinutes,
|
|
647
|
+
limitResponsePayload: limitResponsePayload
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// Get the appropriate client based on transport type
|
|
651
|
+
const sunsamaClient = getSunsamaClient(session as SessionData | null);
|
|
652
|
+
|
|
653
|
+
// Call sunsamaClient.updateTaskPlannedTime(taskId, timeEstimateMinutes, limitResponsePayload)
|
|
654
|
+
const result = await sunsamaClient.updateTaskPlannedTime(
|
|
655
|
+
taskId,
|
|
656
|
+
timeEstimateMinutes,
|
|
657
|
+
limitResponsePayload
|
|
658
|
+
);
|
|
659
|
+
|
|
660
|
+
log.info("Successfully updated task planned time", {
|
|
661
|
+
taskId: taskId,
|
|
662
|
+
timeEstimateMinutes: timeEstimateMinutes,
|
|
663
|
+
success: result.success
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
return {
|
|
667
|
+
content: [
|
|
668
|
+
{
|
|
669
|
+
type: "text",
|
|
670
|
+
text: JSON.stringify({
|
|
671
|
+
success: result.success,
|
|
672
|
+
taskId: taskId,
|
|
673
|
+
timeEstimateMinutes: timeEstimateMinutes,
|
|
674
|
+
updatedFields: result.updatedFields
|
|
675
|
+
})
|
|
676
|
+
}
|
|
677
|
+
]
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
} catch (error) {
|
|
681
|
+
log.error("Failed to update task planned time", {
|
|
682
|
+
taskId: args.taskId,
|
|
683
|
+
timeEstimateMinutes: args.timeEstimateMinutes,
|
|
684
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
throw new Error(`Failed to update task planned time: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
|
|
633
692
|
// Stream Operations
|
|
634
693
|
server.addTool({
|
|
635
694
|
name: "get-streams",
|
package/src/schemas.test.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
deleteTaskSchema,
|
|
12
12
|
updateTaskSnoozeDateSchema,
|
|
13
13
|
updateTaskBacklogSchema,
|
|
14
|
+
updateTaskPlannedTimeSchema,
|
|
14
15
|
userProfileSchema,
|
|
15
16
|
groupSchema,
|
|
16
17
|
userSchema,
|
|
@@ -283,6 +284,73 @@ describe("Tool Parameter Schemas", () => {
|
|
|
283
284
|
).toThrow();
|
|
284
285
|
});
|
|
285
286
|
});
|
|
287
|
+
|
|
288
|
+
describe("updateTaskPlannedTimeSchema", () => {
|
|
289
|
+
test("should accept valid task planned time input", () => {
|
|
290
|
+
const validInput = {
|
|
291
|
+
taskId: "task-123",
|
|
292
|
+
timeEstimateMinutes: 45,
|
|
293
|
+
limitResponsePayload: true,
|
|
294
|
+
};
|
|
295
|
+
expect(() => updateTaskPlannedTimeSchema.parse(validInput)).not.toThrow();
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
test("should accept minimal required input", () => {
|
|
299
|
+
const minimalInput = {
|
|
300
|
+
taskId: "task-123",
|
|
301
|
+
timeEstimateMinutes: 30
|
|
302
|
+
};
|
|
303
|
+
expect(() => updateTaskPlannedTimeSchema.parse(minimalInput)).not.toThrow();
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
test("should accept zero time estimate", () => {
|
|
307
|
+
const zeroInput = {
|
|
308
|
+
taskId: "task-123",
|
|
309
|
+
timeEstimateMinutes: 0
|
|
310
|
+
};
|
|
311
|
+
expect(() => updateTaskPlannedTimeSchema.parse(zeroInput)).not.toThrow();
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test("should reject empty task ID", () => {
|
|
315
|
+
expect(() =>
|
|
316
|
+
updateTaskPlannedTimeSchema.parse({
|
|
317
|
+
taskId: "",
|
|
318
|
+
timeEstimateMinutes: 30
|
|
319
|
+
})
|
|
320
|
+
).toThrow();
|
|
321
|
+
expect(() =>
|
|
322
|
+
updateTaskPlannedTimeSchema.parse({
|
|
323
|
+
timeEstimateMinutes: 30
|
|
324
|
+
})
|
|
325
|
+
).toThrow();
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
test("should reject negative time estimate", () => {
|
|
329
|
+
expect(() =>
|
|
330
|
+
updateTaskPlannedTimeSchema.parse({
|
|
331
|
+
taskId: "task-123",
|
|
332
|
+
timeEstimateMinutes: -1
|
|
333
|
+
})
|
|
334
|
+
).toThrow();
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
test("should reject non-integer time estimate", () => {
|
|
338
|
+
expect(() =>
|
|
339
|
+
updateTaskPlannedTimeSchema.parse({
|
|
340
|
+
taskId: "task-123",
|
|
341
|
+
timeEstimateMinutes: 30.5
|
|
342
|
+
})
|
|
343
|
+
).toThrow();
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
test("should reject missing time estimate", () => {
|
|
347
|
+
expect(() =>
|
|
348
|
+
updateTaskPlannedTimeSchema.parse({
|
|
349
|
+
taskId: "task-123"
|
|
350
|
+
})
|
|
351
|
+
).toThrow();
|
|
352
|
+
});
|
|
353
|
+
});
|
|
286
354
|
});
|
|
287
355
|
|
|
288
356
|
describe("Response Schemas", () => {
|
package/src/schemas.ts
CHANGED
|
@@ -87,6 +87,13 @@ export const updateTaskBacklogSchema = z.object({
|
|
|
87
87
|
limitResponsePayload: z.boolean().optional().describe("Whether to limit the response payload size"),
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
+
// Update task planned time parameters
|
|
91
|
+
export const updateTaskPlannedTimeSchema = z.object({
|
|
92
|
+
taskId: z.string().min(1, "Task ID is required").describe("The ID of the task to update planned time for"),
|
|
93
|
+
timeEstimateMinutes: z.number().int().min(0).describe("Time estimate in minutes (use 0 to clear the time estimate)"),
|
|
94
|
+
limitResponsePayload: z.boolean().optional().describe("Whether to limit the response payload size"),
|
|
95
|
+
});
|
|
96
|
+
|
|
90
97
|
/**
|
|
91
98
|
* Response Type Schemas (for validation and documentation)
|
|
92
99
|
*/
|
|
@@ -188,6 +195,7 @@ export type CreateTaskInput = z.infer<typeof createTaskSchema>;
|
|
|
188
195
|
export type UpdateTaskCompleteInput = z.infer<typeof updateTaskCompleteSchema>;
|
|
189
196
|
export type DeleteTaskInput = z.infer<typeof deleteTaskSchema>;
|
|
190
197
|
export type UpdateTaskSnoozeDateInput = z.infer<typeof updateTaskSnoozeDateSchema>;
|
|
198
|
+
export type UpdateTaskPlannedTimeInput = z.infer<typeof updateTaskPlannedTimeSchema>;
|
|
191
199
|
|
|
192
200
|
export type User = z.infer<typeof userSchema>;
|
|
193
201
|
export type Task = z.infer<typeof taskSchema>;
|