@doist/todoist-ai 4.9.4 → 4.11.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 +1 -1
- 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__/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-completed-tasks.test.js +71 -12
- 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/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-completed-tasks.d.ts +12 -12
- package/dist/tools/find-completed-tasks.d.ts.map +1 -1
- package/dist/tools/find-completed-tasks.js +15 -1
- 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/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 +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { getErrorOutput } from '../mcp-helpers.js';
|
|
3
|
+
import { buildTodoistUrl, getTasksByFilter } from '../tool-helpers.js';
|
|
4
|
+
import { ApiLimits } from '../utils/constants.js';
|
|
5
|
+
import { ToolNames } from '../utils/tool-names.js';
|
|
6
|
+
const ArgsSchema = {
|
|
7
|
+
query: z.string().min(1).describe('The search query string to find tasks and projects.'),
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* OpenAI MCP search tool - returns a list of relevant search results from Todoist.
|
|
11
|
+
*
|
|
12
|
+
* This tool follows the OpenAI MCP search tool specification:
|
|
13
|
+
* @see https://platform.openai.com/docs/mcp#search-tool
|
|
14
|
+
*/
|
|
15
|
+
const search = {
|
|
16
|
+
name: ToolNames.SEARCH,
|
|
17
|
+
description: 'Search across tasks and projects in Todoist. Returns a list of relevant results with IDs, titles, and URLs.',
|
|
18
|
+
parameters: ArgsSchema,
|
|
19
|
+
async execute(args, client) {
|
|
20
|
+
try {
|
|
21
|
+
const { query } = args;
|
|
22
|
+
// Search both tasks and projects in parallel
|
|
23
|
+
// Use TASKS_MAX for search since this tool doesn't support pagination
|
|
24
|
+
const [tasksResult, projectsResponse] = await Promise.all([
|
|
25
|
+
getTasksByFilter({
|
|
26
|
+
client,
|
|
27
|
+
query: `search: ${query}`,
|
|
28
|
+
limit: ApiLimits.TASKS_MAX,
|
|
29
|
+
cursor: undefined,
|
|
30
|
+
}),
|
|
31
|
+
client.getProjects({ limit: ApiLimits.PROJECTS_MAX }),
|
|
32
|
+
]);
|
|
33
|
+
// Filter projects by search query (case-insensitive)
|
|
34
|
+
const searchLower = query.toLowerCase();
|
|
35
|
+
const matchingProjects = projectsResponse.results.filter((project) => project.name.toLowerCase().includes(searchLower));
|
|
36
|
+
// Build results array
|
|
37
|
+
const results = [];
|
|
38
|
+
// Add task results with composite IDs
|
|
39
|
+
for (const task of tasksResult.tasks) {
|
|
40
|
+
results.push({
|
|
41
|
+
id: `task:${task.id}`,
|
|
42
|
+
title: task.content,
|
|
43
|
+
url: buildTodoistUrl('task', task.id),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// Add project results with composite IDs
|
|
47
|
+
for (const project of matchingProjects) {
|
|
48
|
+
results.push({
|
|
49
|
+
id: `project:${project.id}`,
|
|
50
|
+
title: project.name,
|
|
51
|
+
url: buildTodoistUrl('project', project.id),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Return as JSON-encoded string in a text content item (OpenAI MCP spec)
|
|
55
|
+
const jsonText = JSON.stringify({ results });
|
|
56
|
+
return { content: [{ type: 'text', text: jsonText }] };
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
const message = error instanceof Error ? error.message : 'An unknown error occurred';
|
|
60
|
+
return getErrorOutput(message);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export { search };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-tasks.d.ts","sourceRoot":"","sources":["../../src/tools/update-tasks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"update-tasks.d.ts","sourceRoot":"","sources":["../../src/tools/update-tasks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA8DvB,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkHyB,CAAA;AAqC1C,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -9,8 +9,14 @@ import { ToolNames } from '../utils/tool-names.js';
|
|
|
9
9
|
const { FIND_TASKS_BY_DATE, GET_OVERVIEW } = ToolNames;
|
|
10
10
|
const TasksUpdateSchema = z.object({
|
|
11
11
|
id: z.string().min(1).describe('The ID of the task to update.'),
|
|
12
|
-
content: z
|
|
13
|
-
|
|
12
|
+
content: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('The new task name/title. Should be concise and actionable (e.g., "Review PR #123", "Call dentist"). For longer content, use the description field instead. Supports Markdown.'),
|
|
16
|
+
description: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('New additional details, notes, or context for the task. Use this for longer content rather than putting it in the task name. Supports Markdown.'),
|
|
14
20
|
projectId: z.string().optional().describe('The new project ID for the task.'),
|
|
15
21
|
sectionId: z.string().optional().describe('The new section ID for the task.'),
|
|
16
22
|
parentId: z.string().optional().describe('The new parent task ID (for subtasks).'),
|
|
@@ -8,7 +8,7 @@ export declare const ApiLimits: {
|
|
|
8
8
|
/** Default limit for task listings */
|
|
9
9
|
readonly TASKS_DEFAULT: 10;
|
|
10
10
|
/** Maximum limit for task search and list operations */
|
|
11
|
-
readonly TASKS_MAX:
|
|
11
|
+
readonly TASKS_MAX: 100;
|
|
12
12
|
/** Default limit for completed tasks */
|
|
13
13
|
readonly COMPLETED_TASKS_DEFAULT: 50;
|
|
14
14
|
/** Maximum limit for completed tasks */
|
package/dist/utils/constants.js
CHANGED
|
@@ -9,7 +9,7 @@ export const ApiLimits = {
|
|
|
9
9
|
/** Default limit for task listings */
|
|
10
10
|
TASKS_DEFAULT: 10,
|
|
11
11
|
/** Maximum limit for task search and list operations */
|
|
12
|
-
TASKS_MAX:
|
|
12
|
+
TASKS_MAX: 100,
|
|
13
13
|
/** Default limit for completed tasks */
|
|
14
14
|
COMPLETED_TASKS_DEFAULT: 50,
|
|
15
15
|
/** Maximum limit for completed tasks */
|
|
@@ -26,6 +26,8 @@ export declare const ToolNames: {
|
|
|
26
26
|
readonly GET_OVERVIEW: "get-overview";
|
|
27
27
|
readonly DELETE_OBJECT: "delete-object";
|
|
28
28
|
readonly USER_INFO: "user-info";
|
|
29
|
+
readonly SEARCH: "search";
|
|
30
|
+
readonly FETCH: "fetch";
|
|
29
31
|
};
|
|
30
32
|
export type ToolName = (typeof ToolNames)[keyof typeof ToolNames];
|
|
31
33
|
//# sourceMappingURL=tool-names.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-names.d.ts","sourceRoot":"","sources":["../../src/utils/tool-names.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"tool-names.d.ts","sourceRoot":"","sources":["../../src/utils/tool-names.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;CAoCZ,CAAA;AAGV,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA"}
|
package/dist/utils/tool-names.js
CHANGED