@doist/todoist-ai 4.9.3 → 4.10.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 +11 -0
- package/dist/index.d.ts +37 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/mcp-helpers.d.ts +8 -1
- package/dist/mcp-helpers.d.ts.map +1 -1
- package/dist/mcp-helpers.js +6 -3
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +5 -0
- package/dist/tool-helpers.d.ts +8 -1
- package/dist/tool-helpers.d.ts.map +1 -1
- package/dist/tool-helpers.js +13 -10
- package/dist/tools/__tests__/add-projects.test.js +5 -1
- package/dist/tools/__tests__/add-sections.test.js +5 -1
- package/dist/tools/__tests__/assignment-integration.test.js +1 -1
- package/dist/tools/__tests__/complete-tasks.test.js +6 -6
- package/dist/tools/__tests__/fetch.test.d.ts +2 -0
- package/dist/tools/__tests__/fetch.test.d.ts.map +1 -0
- package/dist/tools/__tests__/fetch.test.js +275 -0
- package/dist/tools/__tests__/find-comments.test.js +3 -9
- package/dist/tools/__tests__/find-projects.test.js +0 -2
- package/dist/tools/__tests__/find-sections.test.js +1 -5
- package/dist/tools/__tests__/find-tasks.test.js +3 -5
- package/dist/tools/__tests__/get-overview.test.js +7 -9
- package/dist/tools/__tests__/search.test.d.ts +2 -0
- package/dist/tools/__tests__/search.test.d.ts.map +1 -0
- package/dist/tools/__tests__/search.test.js +208 -0
- package/dist/tools/__tests__/update-comments.test.js +0 -2
- package/dist/tools/__tests__/update-projects.test.js +14 -2
- package/dist/tools/__tests__/update-sections.test.js +14 -2
- package/dist/tools/__tests__/update-tasks.test.js +1 -1
- package/dist/tools/add-tasks.d.ts.map +1 -1
- package/dist/tools/add-tasks.js +8 -2
- package/dist/tools/fetch.d.ts +26 -0
- package/dist/tools/fetch.d.ts.map +1 -0
- package/dist/tools/fetch.js +99 -0
- package/dist/tools/find-projects.d.ts +2 -2
- package/dist/tools/search.d.ts +26 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +64 -0
- package/dist/tools/update-tasks.d.ts.map +1 -1
- package/dist/tools/update-tasks.js +8 -2
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/sanitize-data.d.ts +9 -0
- package/dist/utils/sanitize-data.d.ts.map +1 -0
- package/dist/utils/sanitize-data.js +37 -0
- package/dist/utils/sanitize-data.test.d.ts +2 -0
- package/dist/utils/sanitize-data.test.d.ts.map +1 -0
- package/dist/utils/sanitize-data.test.js +93 -0
- package/dist/utils/tool-names.d.ts +2 -0
- package/dist/utils/tool-names.d.ts.map +1 -1
- package/dist/utils/tool-names.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -74,10 +74,17 @@ Then enable the server in Cursor settings if prompted.
|
|
|
74
74
|
|
|
75
75
|
#### Claude Code (CLI)
|
|
76
76
|
|
|
77
|
+
Firstly configure Claude so it has a new MCP available using this command:
|
|
78
|
+
|
|
77
79
|
```bash
|
|
78
80
|
claude mcp add --transport http todoist https://ai.todoist.net/mcp
|
|
79
81
|
```
|
|
80
82
|
|
|
83
|
+
Then launch `claude`, execute `/mcp`, then select the `todoist` MCP server.
|
|
84
|
+
|
|
85
|
+
This will take you through a wizard to authenticate using your browser with Todoist. Once complete you will be able to use todoist in `claude`.
|
|
86
|
+
|
|
87
|
+
|
|
81
88
|
#### Visual Studio Code
|
|
82
89
|
|
|
83
90
|
1. Open Command Palette → MCP: Add Server
|
|
@@ -116,6 +123,10 @@ For our design philosophy, guidelines, and development patterns, see [docs/tool-
|
|
|
116
123
|
|
|
117
124
|
For a complete list of available tools, see the [src/tools](src/tools) directory.
|
|
118
125
|
|
|
126
|
+
#### OpenAI MCP Compatibility
|
|
127
|
+
|
|
128
|
+
This server includes `search` and `fetch` tools that follow the [OpenAI MCP specification](https://platform.openai.com/docs/mcp), enabling seamless integration with OpenAI's MCP protocol. These tools return JSON-encoded results optimized for OpenAI's requirements while maintaining compatibility with the broader MCP ecosystem.
|
|
129
|
+
|
|
119
130
|
## Dependencies
|
|
120
131
|
|
|
121
132
|
- MCP server using the official [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/typescript-sdk?tab=readme-ov-file#installation)
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { addSections } from './tools/add-sections.js';
|
|
|
5
5
|
import { addTasks } from './tools/add-tasks.js';
|
|
6
6
|
import { completeTasks } from './tools/complete-tasks.js';
|
|
7
7
|
import { deleteObject } from './tools/delete-object.js';
|
|
8
|
+
import { fetch } from './tools/fetch.js';
|
|
8
9
|
import { findComments } from './tools/find-comments.js';
|
|
9
10
|
import { findCompletedTasks } from './tools/find-completed-tasks.js';
|
|
10
11
|
import { findProjectCollaborators } from './tools/find-project-collaborators.js';
|
|
@@ -14,6 +15,7 @@ import { findTasks } from './tools/find-tasks.js';
|
|
|
14
15
|
import { findTasksByDate } from './tools/find-tasks-by-date.js';
|
|
15
16
|
import { getOverview } from './tools/get-overview.js';
|
|
16
17
|
import { manageAssignments } from './tools/manage-assignments.js';
|
|
18
|
+
import { search } from './tools/search.js';
|
|
17
19
|
import { updateComments } from './tools/update-comments.js';
|
|
18
20
|
import { updateProjects } from './tools/update-projects.js';
|
|
19
21
|
import { updateSections } from './tools/update-sections.js';
|
|
@@ -673,8 +675,8 @@ declare const tools: {
|
|
|
673
675
|
};
|
|
674
676
|
execute(args: {
|
|
675
677
|
limit: number;
|
|
676
|
-
cursor?: string | undefined;
|
|
677
678
|
search?: string | undefined;
|
|
679
|
+
cursor?: string | undefined;
|
|
678
680
|
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
679
681
|
content: {
|
|
680
682
|
type: "text";
|
|
@@ -696,8 +698,8 @@ declare const tools: {
|
|
|
696
698
|
hasMore: boolean;
|
|
697
699
|
appliedFilters: {
|
|
698
700
|
limit: number;
|
|
699
|
-
cursor?: string | undefined;
|
|
700
701
|
search?: string | undefined;
|
|
702
|
+
cursor?: string | undefined;
|
|
701
703
|
};
|
|
702
704
|
};
|
|
703
705
|
} | {
|
|
@@ -1257,7 +1259,39 @@ declare const tools: {
|
|
|
1257
1259
|
structuredContent?: undefined;
|
|
1258
1260
|
}>;
|
|
1259
1261
|
};
|
|
1262
|
+
search: {
|
|
1263
|
+
name: "search";
|
|
1264
|
+
description: string;
|
|
1265
|
+
parameters: {
|
|
1266
|
+
query: import("zod").ZodString;
|
|
1267
|
+
};
|
|
1268
|
+
execute(args: {
|
|
1269
|
+
query: string;
|
|
1270
|
+
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
1271
|
+
content: {
|
|
1272
|
+
type: "text";
|
|
1273
|
+
text: string;
|
|
1274
|
+
}[];
|
|
1275
|
+
isError?: boolean;
|
|
1276
|
+
}>;
|
|
1277
|
+
};
|
|
1278
|
+
fetch: {
|
|
1279
|
+
name: "fetch";
|
|
1280
|
+
description: string;
|
|
1281
|
+
parameters: {
|
|
1282
|
+
id: import("zod").ZodString;
|
|
1283
|
+
};
|
|
1284
|
+
execute(args: {
|
|
1285
|
+
id: string;
|
|
1286
|
+
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
1287
|
+
content: {
|
|
1288
|
+
type: "text";
|
|
1289
|
+
text: string;
|
|
1290
|
+
}[];
|
|
1291
|
+
isError?: boolean;
|
|
1292
|
+
}>;
|
|
1293
|
+
};
|
|
1260
1294
|
};
|
|
1261
1295
|
export { tools, getMcpServer };
|
|
1262
|
-
export { addTasks, completeTasks, updateTasks, findTasks, findTasksByDate, findCompletedTasks, addProjects, updateProjects, findProjects, addSections, updateSections, findSections, addComments, updateComments, findComments, getOverview, deleteObject, userInfo, findProjectCollaborators, manageAssignments, };
|
|
1296
|
+
export { addTasks, completeTasks, updateTasks, findTasks, findTasksByDate, findCompletedTasks, addProjects, updateProjects, findProjects, addSections, updateSections, findSections, addComments, updateComments, findComments, getOverview, deleteObject, userInfo, findProjectCollaborators, manageAssignments, search, fetch, };
|
|
1263
1297
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,Q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AC;gCAA6C,CAAC;gCAA6C,CAAC;+BAA4C,CAAC;oCAAiD,CAAC;mCAAgD,CAAC;6BAA2D,CAAC;kCAA+C,CAAC;mCAAgD,CAAC;2BAAwC,CAAC;6BAA0C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAA9d,CAAC;gCAA6C,CAAC;gCAA6C,CAAC;+BAA4C,CAAC;oCAAiD,CAAC;mCAAgD,CAAC;6BAA2D,CAAC;kCAA+C,CAAC;mCAAgD,CAAC;2BAAwC,CAAC;6BAA0C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAnCrxY,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAA;AAE9B,OAAO,EAEH,QAAQ,EACR,aAAa,EACb,WAAW,EACX,SAAS,EACT,eAAe,EACf,kBAAkB,EAElB,WAAW,EACX,cAAc,EACd,YAAY,EAEZ,WAAW,EACX,cAAc,EACd,YAAY,EAEZ,WAAW,EACX,cAAc,EACd,YAAY,EAEZ,WAAW,EACX,YAAY,EACZ,QAAQ,EAER,wBAAwB,EACxB,iBAAiB,EAEjB,MAAM,EACN,KAAK,GACR,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { addTasks } from './tools/add-tasks.js';
|
|
|
10
10
|
import { completeTasks } from './tools/complete-tasks.js';
|
|
11
11
|
// General tools
|
|
12
12
|
import { deleteObject } from './tools/delete-object.js';
|
|
13
|
+
import { fetch } from './tools/fetch.js';
|
|
13
14
|
import { findComments } from './tools/find-comments.js';
|
|
14
15
|
import { findCompletedTasks } from './tools/find-completed-tasks.js';
|
|
15
16
|
// Assignment and collaboration tools
|
|
@@ -20,6 +21,7 @@ import { findTasks } from './tools/find-tasks.js';
|
|
|
20
21
|
import { findTasksByDate } from './tools/find-tasks-by-date.js';
|
|
21
22
|
import { getOverview } from './tools/get-overview.js';
|
|
22
23
|
import { manageAssignments } from './tools/manage-assignments.js';
|
|
24
|
+
import { search } from './tools/search.js';
|
|
23
25
|
import { updateComments } from './tools/update-comments.js';
|
|
24
26
|
import { updateProjects } from './tools/update-projects.js';
|
|
25
27
|
import { updateSections } from './tools/update-sections.js';
|
|
@@ -52,6 +54,9 @@ const tools = {
|
|
|
52
54
|
// Assignment and collaboration tools
|
|
53
55
|
findProjectCollaborators,
|
|
54
56
|
manageAssignments,
|
|
57
|
+
// OpenAI MCP tools
|
|
58
|
+
search,
|
|
59
|
+
fetch,
|
|
55
60
|
};
|
|
56
61
|
export { tools, getMcpServer };
|
|
57
62
|
export {
|
|
@@ -66,4 +71,6 @@ addComments, updateComments, findComments,
|
|
|
66
71
|
// General tools
|
|
67
72
|
getOverview, deleteObject, userInfo,
|
|
68
73
|
// Assignment and collaboration tools
|
|
69
|
-
findProjectCollaborators, manageAssignments,
|
|
74
|
+
findProjectCollaborators, manageAssignments,
|
|
75
|
+
// OpenAI MCP tools
|
|
76
|
+
search, fetch, };
|
package/dist/mcp-helpers.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ declare function getToolOutput<StructuredContent extends Record<string, unknown>
|
|
|
31
31
|
})[];
|
|
32
32
|
structuredContent?: undefined;
|
|
33
33
|
};
|
|
34
|
+
declare function getErrorOutput(error: string): {
|
|
35
|
+
content: {
|
|
36
|
+
type: "text";
|
|
37
|
+
text: string;
|
|
38
|
+
}[];
|
|
39
|
+
isError: boolean;
|
|
40
|
+
};
|
|
34
41
|
/**
|
|
35
42
|
* Register a Todoist tool in an MCP server.
|
|
36
43
|
* @param tool - The tool to register.
|
|
@@ -38,5 +45,5 @@ declare function getToolOutput<StructuredContent extends Record<string, unknown>
|
|
|
38
45
|
* @param client - The Todoist API client to use to execute the tool.
|
|
39
46
|
*/
|
|
40
47
|
declare function registerTool<Params extends z.ZodRawShape>(tool: TodoistTool<Params>, server: McpServer, client: TodoistApi): void;
|
|
41
|
-
export { registerTool, getToolOutput };
|
|
48
|
+
export { registerTool, getErrorOutput, getToolOutput };
|
|
42
49
|
//# sourceMappingURL=mcp-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-helpers.d.ts","sourceRoot":"","sources":["../src/mcp-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,yCAAyC,CAAA;AACtF,OAAO,KAAK,EAAc,CAAC,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-helpers.d.ts","sourceRoot":"","sources":["../src/mcp-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,yCAAyC,CAAA;AACtF,OAAO,KAAK,EAAc,CAAC,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAmBpD;;;;;;;GAOG;AACH,iBAAS,aAAa,CAAC,iBAAiB,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACtE,WAAW,EACX,iBAAiB,GACpB,EAAE;IACC,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,iBAAiB,CAAA;CACvC;;;;;;;;;;;;;;;;;EAkBA;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,MAAM;;;;;;EAKpC;AAED;;;;;GAKG;AACH,iBAAS,YAAY,CAAC,MAAM,SAAS,CAAC,CAAC,WAAW,EAC9C,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EACzB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,QAqBrB;AAED,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAA"}
|
package/dist/mcp-helpers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { removeNullFields } from './utils/sanitize-data.js';
|
|
1
2
|
/**
|
|
2
3
|
* Wether to return the structured content directly, vs. in the `content` part of the output.
|
|
3
4
|
*
|
|
@@ -21,13 +22,15 @@ const USE_STRUCTURED_CONTENT = process.env.USE_STRUCTURED_CONTENT === 'true' ||
|
|
|
21
22
|
* @see USE_STRUCTURED_CONTENT - Wether to use the structured content feature of the MCP protocol.
|
|
22
23
|
*/
|
|
23
24
|
function getToolOutput({ textContent, structuredContent, }) {
|
|
25
|
+
// Remove null fields from structured content before returning
|
|
26
|
+
const sanitizedContent = removeNullFields(structuredContent);
|
|
24
27
|
if (USE_STRUCTURED_CONTENT) {
|
|
25
28
|
return {
|
|
26
29
|
content: [{ type: 'text', text: textContent }],
|
|
27
|
-
structuredContent,
|
|
30
|
+
structuredContent: sanitizedContent,
|
|
28
31
|
};
|
|
29
32
|
}
|
|
30
|
-
const json = JSON.stringify(
|
|
33
|
+
const json = JSON.stringify(sanitizedContent);
|
|
31
34
|
return {
|
|
32
35
|
content: [
|
|
33
36
|
{ type: 'text', text: textContent },
|
|
@@ -65,4 +68,4 @@ function registerTool(tool, server, client) {
|
|
|
65
68
|
};
|
|
66
69
|
server.tool(tool.name, tool.description, tool.parameters, cb);
|
|
67
70
|
}
|
|
68
|
-
export { registerTool, getToolOutput };
|
|
71
|
+
export { registerTool, getErrorOutput, getToolOutput };
|
package/dist/mcp-server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AA0FnE;;;;;GAKG;AACH,iBAAS,YAAY,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,aAkD5F;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/mcp-server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { addSections } from './tools/add-sections.js';
|
|
|
7
7
|
import { addTasks } from './tools/add-tasks.js';
|
|
8
8
|
import { completeTasks } from './tools/complete-tasks.js';
|
|
9
9
|
import { deleteObject } from './tools/delete-object.js';
|
|
10
|
+
import { fetch } from './tools/fetch.js';
|
|
10
11
|
import { findComments } from './tools/find-comments.js';
|
|
11
12
|
import { findCompletedTasks } from './tools/find-completed-tasks.js';
|
|
12
13
|
import { findProjectCollaborators } from './tools/find-project-collaborators.js';
|
|
@@ -16,6 +17,7 @@ import { findTasks } from './tools/find-tasks.js';
|
|
|
16
17
|
import { findTasksByDate } from './tools/find-tasks-by-date.js';
|
|
17
18
|
import { getOverview } from './tools/get-overview.js';
|
|
18
19
|
import { manageAssignments } from './tools/manage-assignments.js';
|
|
20
|
+
import { search } from './tools/search.js';
|
|
19
21
|
import { updateComments } from './tools/update-comments.js';
|
|
20
22
|
import { updateProjects } from './tools/update-projects.js';
|
|
21
23
|
import { updateSections } from './tools/update-sections.js';
|
|
@@ -125,6 +127,9 @@ function getMcpServer({ todoistApiKey, baseUrl }) {
|
|
|
125
127
|
// Assignment and collaboration tools
|
|
126
128
|
registerTool(findProjectCollaborators, server, todoist);
|
|
127
129
|
registerTool(manageAssignments, server, todoist);
|
|
130
|
+
// OpenAI MCP tools
|
|
131
|
+
registerTool(search, server, todoist);
|
|
132
|
+
registerTool(fetch, server, todoist);
|
|
128
133
|
return server;
|
|
129
134
|
}
|
|
130
135
|
export { getMcpServer };
|
package/dist/tool-helpers.d.ts
CHANGED
|
@@ -89,5 +89,12 @@ declare function getTasksByFilter({ client, query, limit, cursor, }: {
|
|
|
89
89
|
}[];
|
|
90
90
|
nextCursor: string | null;
|
|
91
91
|
}>;
|
|
92
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Build a Todoist URL for a task or project.
|
|
94
|
+
* @param type - The type of object ('task' or 'project')
|
|
95
|
+
* @param id - The ID of the object
|
|
96
|
+
* @returns The URL string
|
|
97
|
+
*/
|
|
98
|
+
declare function buildTodoistUrl(type: 'task' | 'project', id: string): string;
|
|
99
|
+
export { getTasksByFilter, mapTask, mapProject, buildTodoistUrl };
|
|
93
100
|
//# sourceMappingURL=tool-helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../src/tool-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EACZ,eAAe,EACf,IAAI,EACJ,UAAU,EACV,gBAAgB,EACnB,MAAM,+BAA+B,CAAA;AAItC,eAAO,MAAM,0BAA0B,gDAAiD,CAAA;AACxF,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAA;AAElF,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAExD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,eAAe,CAE9E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,gBAAgB,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS;IAAE,c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AO,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAA"}
|
package/dist/tool-helpers.js
CHANGED
|
@@ -105,15 +105,9 @@ const ErrorSchema = z.object({
|
|
|
105
105
|
});
|
|
106
106
|
async function getTasksByFilter({ client, query, limit, cursor, }) {
|
|
107
107
|
try {
|
|
108
|
-
const { results, nextCursor } = await client.getTasksByFilter({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
limit,
|
|
112
|
-
});
|
|
113
|
-
return {
|
|
114
|
-
tasks: results.map(mapTask),
|
|
115
|
-
nextCursor,
|
|
116
|
-
};
|
|
108
|
+
const { results, nextCursor } = await client.getTasksByFilter({ query, cursor, limit });
|
|
109
|
+
const tasks = results.map(mapTask);
|
|
110
|
+
return { tasks, nextCursor };
|
|
117
111
|
}
|
|
118
112
|
catch (error) {
|
|
119
113
|
const parsedError = ErrorSchema.safeParse(error);
|
|
@@ -127,4 +121,13 @@ async function getTasksByFilter({ client, query, limit, cursor, }) {
|
|
|
127
121
|
throw new Error(`${responseData.error} (tag: ${responseData.errorTag}, code: ${responseData.errorCode})`);
|
|
128
122
|
}
|
|
129
123
|
}
|
|
130
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Build a Todoist URL for a task or project.
|
|
126
|
+
* @param type - The type of object ('task' or 'project')
|
|
127
|
+
* @param id - The ID of the object
|
|
128
|
+
* @returns The URL string
|
|
129
|
+
*/
|
|
130
|
+
function buildTodoistUrl(type, id) {
|
|
131
|
+
return `https://app.todoist.com/app/${type}/${id}`;
|
|
132
|
+
}
|
|
133
|
+
export { getTasksByFilter, mapTask, mapProject, buildTodoistUrl };
|
|
@@ -143,7 +143,11 @@ describe(`${ADD_PROJECTS} tool`, () => {
|
|
|
143
143
|
// Verify structured content
|
|
144
144
|
const structuredContent = extractStructuredContent(result);
|
|
145
145
|
expect(structuredContent).toEqual(expect.objectContaining({
|
|
146
|
-
projects:
|
|
146
|
+
projects: expect.arrayContaining([
|
|
147
|
+
expect.objectContaining({ id: 'project-1', name: 'First Project' }),
|
|
148
|
+
expect.objectContaining({ id: 'project-2', name: 'Second Project' }),
|
|
149
|
+
expect.objectContaining({ id: 'project-3', name: 'Third Project' }),
|
|
150
|
+
]),
|
|
147
151
|
totalCount: 3,
|
|
148
152
|
}));
|
|
149
153
|
});
|
|
@@ -122,7 +122,11 @@ describe(`${ADD_SECTIONS} tool`, () => {
|
|
|
122
122
|
// Verify structured content
|
|
123
123
|
const structuredContent = extractStructuredContent(result);
|
|
124
124
|
expect(structuredContent).toEqual(expect.objectContaining({
|
|
125
|
-
sections:
|
|
125
|
+
sections: expect.arrayContaining([
|
|
126
|
+
expect.objectContaining({ id: 'section-1', name: 'First Section' }),
|
|
127
|
+
expect.objectContaining({ id: 'section-2', name: 'Second Section' }),
|
|
128
|
+
expect.objectContaining({ id: 'section-3', name: 'Third Section' }),
|
|
129
|
+
]),
|
|
126
130
|
totalCount: 3,
|
|
127
131
|
}));
|
|
128
132
|
});
|
|
@@ -311,7 +311,7 @@ describe('Assignment Integration Tests', () => {
|
|
|
311
311
|
projectId: 'project-123',
|
|
312
312
|
}, mockTodoistApi);
|
|
313
313
|
expect(extractTextContent(result)).toContain('is not shared and has no collaborators');
|
|
314
|
-
expect(extractStructuredContent(result).collaborators).
|
|
314
|
+
expect(extractStructuredContent(result).collaborators).toBeUndefined(); // Empty arrays are removed
|
|
315
315
|
});
|
|
316
316
|
it('should handle project not found', async () => {
|
|
317
317
|
mockTodoistApi.getProject.mockRejectedValueOnce(new Error('Project not found'));
|
|
@@ -24,13 +24,13 @@ describe(`${COMPLETE_TASKS} tool`, () => {
|
|
|
24
24
|
expect(extractTextContent(result)).toMatchSnapshot();
|
|
25
25
|
// Verify structured content
|
|
26
26
|
const { structuredContent } = result;
|
|
27
|
-
expect(structuredContent).toEqual(
|
|
27
|
+
expect(structuredContent).toEqual({
|
|
28
28
|
completed: ['task-1', 'task-2', 'task-3'],
|
|
29
|
-
failures
|
|
29
|
+
// failures array is removed when empty
|
|
30
30
|
totalRequested: 3,
|
|
31
31
|
successCount: 3,
|
|
32
32
|
failureCount: 0,
|
|
33
|
-
})
|
|
33
|
+
});
|
|
34
34
|
});
|
|
35
35
|
it('should complete single task', async () => {
|
|
36
36
|
mockTodoistApi.closeTask.mockResolvedValue(true);
|
|
@@ -40,13 +40,13 @@ describe(`${COMPLETE_TASKS} tool`, () => {
|
|
|
40
40
|
expect(extractTextContent(result)).toMatchSnapshot();
|
|
41
41
|
// Verify structured content
|
|
42
42
|
const { structuredContent } = result;
|
|
43
|
-
expect(structuredContent).toEqual(
|
|
43
|
+
expect(structuredContent).toEqual({
|
|
44
44
|
completed: ['8485093748'],
|
|
45
|
-
failures
|
|
45
|
+
// failures array is removed when empty
|
|
46
46
|
totalRequested: 1,
|
|
47
47
|
successCount: 1,
|
|
48
48
|
failureCount: 0,
|
|
49
|
-
})
|
|
49
|
+
});
|
|
50
50
|
});
|
|
51
51
|
it('should handle partial failures gracefully', async () => {
|
|
52
52
|
// Mock first and third tasks to succeed, second to fail
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.test.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/fetch.test.ts"],"names":[],"mappings":""}
|