@doist/todoist-ai 3.0.0 → 4.0.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 +2 -18
- package/dist/index.d.ts +175 -47
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -6
- package/dist/main.js +2 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +16 -4
- package/dist/tools/__tests__/add-comments.test.d.ts +2 -0
- package/dist/tools/__tests__/add-comments.test.d.ts.map +1 -0
- package/dist/tools/__tests__/add-comments.test.js +241 -0
- package/dist/tools/__tests__/add-projects.test.d.ts +2 -0
- package/dist/tools/__tests__/add-projects.test.d.ts.map +1 -0
- package/dist/tools/__tests__/add-projects.test.js +152 -0
- package/dist/tools/__tests__/add-sections.test.d.ts +2 -0
- package/dist/tools/__tests__/add-sections.test.d.ts.map +1 -0
- package/dist/tools/__tests__/add-sections.test.js +181 -0
- package/dist/tools/__tests__/add-tasks.test.js +16 -10
- package/dist/tools/__tests__/find-comments.test.d.ts +2 -0
- package/dist/tools/__tests__/find-comments.test.d.ts.map +1 -0
- package/dist/tools/__tests__/find-comments.test.js +242 -0
- package/dist/tools/__tests__/find-sections.test.js +2 -2
- package/dist/tools/__tests__/update-comments.test.d.ts +2 -0
- package/dist/tools/__tests__/update-comments.test.d.ts.map +1 -0
- package/dist/tools/__tests__/update-comments.test.js +296 -0
- package/dist/tools/__tests__/update-projects.test.d.ts +2 -0
- package/dist/tools/__tests__/update-projects.test.d.ts.map +1 -0
- package/dist/tools/__tests__/update-projects.test.js +205 -0
- package/dist/tools/__tests__/update-sections.test.d.ts +2 -0
- package/dist/tools/__tests__/update-sections.test.d.ts.map +1 -0
- package/dist/tools/__tests__/update-sections.test.js +156 -0
- package/dist/tools/add-comments.d.ts +51 -0
- package/dist/tools/add-comments.d.ts.map +1 -0
- package/dist/tools/add-comments.js +79 -0
- package/dist/tools/add-projects.d.ts +50 -0
- package/dist/tools/add-projects.d.ts.map +1 -0
- package/dist/tools/add-projects.js +59 -0
- package/dist/tools/{manage-sections.d.ts → add-sections.d.ts} +21 -13
- package/dist/tools/add-sections.d.ts.map +1 -0
- package/dist/tools/add-sections.js +61 -0
- package/dist/tools/add-tasks.d.ts +15 -8
- package/dist/tools/add-tasks.d.ts.map +1 -1
- package/dist/tools/add-tasks.js +46 -37
- package/dist/tools/delete-object.d.ts +3 -3
- package/dist/tools/delete-object.d.ts.map +1 -1
- package/dist/tools/delete-object.js +13 -3
- package/dist/tools/find-comments.d.ts +46 -0
- package/dist/tools/find-comments.d.ts.map +1 -0
- package/dist/tools/find-comments.js +143 -0
- package/dist/tools/find-projects.js +2 -2
- package/dist/tools/find-sections.js +4 -4
- package/dist/tools/update-comments.d.ts +50 -0
- package/dist/tools/update-comments.d.ts.map +1 -0
- package/dist/tools/update-comments.js +82 -0
- package/dist/tools/update-projects.d.ts +59 -0
- package/dist/tools/update-projects.d.ts.map +1 -0
- package/dist/tools/update-projects.js +84 -0
- package/dist/tools/update-sections.d.ts +47 -0
- package/dist/tools/update-sections.d.ts.map +1 -0
- package/dist/tools/update-sections.js +70 -0
- package/dist/utils/constants.d.ts +4 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +4 -0
- package/dist/utils/tool-names.d.ts +7 -2
- package/dist/utils/tool-names.d.ts.map +1 -1
- package/dist/utils/tool-names.js +8 -2
- package/package.json +1 -1
- package/dist/tools/__tests__/manage-projects.test.d.ts +0 -2
- package/dist/tools/__tests__/manage-projects.test.d.ts.map +0 -1
- package/dist/tools/__tests__/manage-projects.test.js +0 -109
- package/dist/tools/__tests__/manage-sections.test.d.ts +0 -2
- package/dist/tools/__tests__/manage-sections.test.d.ts.map +0 -1
- package/dist/tools/__tests__/manage-sections.test.js +0 -162
- package/dist/tools/manage-projects.d.ts +0 -35
- package/dist/tools/manage-projects.d.ts.map +0 -1
- package/dist/tools/manage-projects.js +0 -63
- package/dist/tools/manage-sections.d.ts.map +0 -1
- package/dist/tools/manage-sections.js +0 -78
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { jest } from '@jest/globals';
|
|
2
|
-
import { TEST_IDS, createMockSection, extractStructuredContent, extractTextContent, } from '../../utils/test-helpers.js';
|
|
3
|
-
import { ToolNames } from '../../utils/tool-names.js';
|
|
4
|
-
import { manageSections } from '../manage-sections.js';
|
|
5
|
-
// Mock the Todoist API
|
|
6
|
-
const mockTodoistApi = {
|
|
7
|
-
addSection: jest.fn(),
|
|
8
|
-
updateSection: jest.fn(),
|
|
9
|
-
};
|
|
10
|
-
const { ADD_TASKS, MANAGE_SECTIONS, FIND_TASKS } = ToolNames;
|
|
11
|
-
describe(`${MANAGE_SECTIONS} tool`, () => {
|
|
12
|
-
beforeEach(() => {
|
|
13
|
-
jest.clearAllMocks();
|
|
14
|
-
});
|
|
15
|
-
describe('creating a new section', () => {
|
|
16
|
-
it('should create a section and return result', async () => {
|
|
17
|
-
const mockApiResponse = createMockSection({
|
|
18
|
-
id: TEST_IDS.SECTION_1,
|
|
19
|
-
projectId: TEST_IDS.PROJECT_TEST,
|
|
20
|
-
name: 'test-abc123def456-section',
|
|
21
|
-
});
|
|
22
|
-
mockTodoistApi.addSection.mockResolvedValue(mockApiResponse);
|
|
23
|
-
const result = await manageSections.execute({ name: 'test-abc123def456-section', projectId: TEST_IDS.PROJECT_TEST }, mockTodoistApi);
|
|
24
|
-
expect(mockTodoistApi.addSection).toHaveBeenCalledWith({
|
|
25
|
-
name: 'test-abc123def456-section',
|
|
26
|
-
projectId: TEST_IDS.PROJECT_TEST,
|
|
27
|
-
});
|
|
28
|
-
const textContent = extractTextContent(result);
|
|
29
|
-
expect(textContent).toMatchSnapshot();
|
|
30
|
-
expect(textContent).toContain('Created section: test-abc123def456-section');
|
|
31
|
-
expect(textContent).toContain(`id=${TEST_IDS.SECTION_1}`);
|
|
32
|
-
expect(textContent).toContain(`Use ${FIND_TASKS} with sectionId`);
|
|
33
|
-
// Verify structured content
|
|
34
|
-
const structuredContent = extractStructuredContent(result);
|
|
35
|
-
expect(structuredContent).toEqual(expect.objectContaining({
|
|
36
|
-
section: expect.objectContaining({
|
|
37
|
-
id: TEST_IDS.SECTION_1,
|
|
38
|
-
name: 'test-abc123def456-section',
|
|
39
|
-
}),
|
|
40
|
-
operation: 'created',
|
|
41
|
-
}));
|
|
42
|
-
});
|
|
43
|
-
it('should handle different section properties from API', async () => {
|
|
44
|
-
const mockApiResponse = createMockSection({
|
|
45
|
-
id: TEST_IDS.SECTION_2,
|
|
46
|
-
projectId: 'project-789',
|
|
47
|
-
sectionOrder: 2,
|
|
48
|
-
name: 'My Section Name',
|
|
49
|
-
});
|
|
50
|
-
mockTodoistApi.addSection.mockResolvedValue(mockApiResponse);
|
|
51
|
-
const result = await manageSections.execute({ name: 'My Section Name', projectId: 'project-789' }, mockTodoistApi);
|
|
52
|
-
expect(mockTodoistApi.addSection).toHaveBeenCalledWith({
|
|
53
|
-
name: 'My Section Name',
|
|
54
|
-
projectId: 'project-789',
|
|
55
|
-
});
|
|
56
|
-
const textContent = extractTextContent(result);
|
|
57
|
-
expect(textContent).toMatchSnapshot();
|
|
58
|
-
expect(textContent).toContain('Created section: My Section Name');
|
|
59
|
-
expect(textContent).toContain(`id=${TEST_IDS.SECTION_2}`);
|
|
60
|
-
expect(textContent).toContain(`Use ${ADD_TASKS} with sectionId`);
|
|
61
|
-
// Verify structured content
|
|
62
|
-
const structuredContent = extractStructuredContent(result);
|
|
63
|
-
expect(structuredContent).toEqual(expect.objectContaining({
|
|
64
|
-
section: expect.objectContaining({
|
|
65
|
-
id: TEST_IDS.SECTION_2,
|
|
66
|
-
name: 'My Section Name',
|
|
67
|
-
}),
|
|
68
|
-
operation: 'created',
|
|
69
|
-
}));
|
|
70
|
-
});
|
|
71
|
-
it('should throw error when projectId is missing for new section', async () => {
|
|
72
|
-
await expect(manageSections.execute({ name: 'test-section' }, mockTodoistApi)).rejects.toThrow('Error: projectId is required when creating a new section (when id is not provided).');
|
|
73
|
-
expect(mockTodoistApi.addSection).not.toHaveBeenCalled();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
describe('updating an existing section', () => {
|
|
77
|
-
it('should update a section when id is provided', async () => {
|
|
78
|
-
const mockApiResponse = {
|
|
79
|
-
id: 'existing-section-123',
|
|
80
|
-
projectId: '6cfCcrrCFg2xP94Q',
|
|
81
|
-
sectionOrder: 1,
|
|
82
|
-
userId: 'test-user',
|
|
83
|
-
addedAt: '2024-01-01T00:00:00Z',
|
|
84
|
-
updatedAt: '2024-01-01T00:00:00Z',
|
|
85
|
-
archivedAt: null,
|
|
86
|
-
isArchived: false,
|
|
87
|
-
isDeleted: false,
|
|
88
|
-
isCollapsed: false,
|
|
89
|
-
name: 'Updated Section Name',
|
|
90
|
-
};
|
|
91
|
-
mockTodoistApi.updateSection.mockResolvedValue(mockApiResponse);
|
|
92
|
-
const result = await manageSections.execute({ id: 'existing-section-123', name: 'Updated Section Name' }, mockTodoistApi);
|
|
93
|
-
expect(mockTodoistApi.updateSection).toHaveBeenCalledWith('existing-section-123', {
|
|
94
|
-
name: 'Updated Section Name',
|
|
95
|
-
});
|
|
96
|
-
const textContent = extractTextContent(result);
|
|
97
|
-
expect(textContent).toMatchSnapshot();
|
|
98
|
-
expect(textContent).toContain('Updated section: Updated Section Name');
|
|
99
|
-
expect(textContent).toContain('id=existing-section-123');
|
|
100
|
-
expect(textContent).toContain(`Use ${FIND_TASKS} with sectionId`);
|
|
101
|
-
// Verify structured content
|
|
102
|
-
const structuredContent = extractStructuredContent(result);
|
|
103
|
-
expect(structuredContent).toEqual(expect.objectContaining({
|
|
104
|
-
section: expect.objectContaining({
|
|
105
|
-
id: 'existing-section-123',
|
|
106
|
-
name: 'Updated Section Name',
|
|
107
|
-
}),
|
|
108
|
-
operation: 'updated',
|
|
109
|
-
}));
|
|
110
|
-
});
|
|
111
|
-
it('should update section without requiring projectId', async () => {
|
|
112
|
-
const mockApiResponse = {
|
|
113
|
-
id: 'section-update-test',
|
|
114
|
-
projectId: 'original-project-id',
|
|
115
|
-
sectionOrder: 3,
|
|
116
|
-
userId: 'test-user',
|
|
117
|
-
addedAt: '2024-01-01T00:00:00Z',
|
|
118
|
-
updatedAt: '2024-01-01T00:00:00Z',
|
|
119
|
-
archivedAt: null,
|
|
120
|
-
isArchived: false,
|
|
121
|
-
isDeleted: false,
|
|
122
|
-
isCollapsed: false,
|
|
123
|
-
name: 'Section New Name',
|
|
124
|
-
};
|
|
125
|
-
mockTodoistApi.updateSection.mockResolvedValue(mockApiResponse);
|
|
126
|
-
const result = await manageSections.execute({
|
|
127
|
-
id: 'section-update-test',
|
|
128
|
-
name: 'Section New Name',
|
|
129
|
-
// Note: projectId not provided for update
|
|
130
|
-
}, mockTodoistApi);
|
|
131
|
-
expect(mockTodoistApi.updateSection).toHaveBeenCalledWith('section-update-test', {
|
|
132
|
-
name: 'Section New Name',
|
|
133
|
-
});
|
|
134
|
-
const textContent = extractTextContent(result);
|
|
135
|
-
expect(textContent).toMatchSnapshot();
|
|
136
|
-
expect(textContent).toContain('Updated section: Section New Name');
|
|
137
|
-
expect(textContent).toContain('id=section-update-test');
|
|
138
|
-
expect(textContent).toContain(`Use ${FIND_TASKS} with sectionId`);
|
|
139
|
-
// Verify structured content
|
|
140
|
-
const structuredContent = extractStructuredContent(result);
|
|
141
|
-
expect(structuredContent).toEqual(expect.objectContaining({
|
|
142
|
-
section: expect.objectContaining({
|
|
143
|
-
id: 'section-update-test',
|
|
144
|
-
name: 'Section New Name',
|
|
145
|
-
}),
|
|
146
|
-
operation: 'updated',
|
|
147
|
-
}));
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
describe('error handling', () => {
|
|
151
|
-
it('should propagate API errors for section creation', async () => {
|
|
152
|
-
const apiError = new Error('API Error: Section name is required');
|
|
153
|
-
mockTodoistApi.addSection.mockRejectedValue(apiError);
|
|
154
|
-
await expect(manageSections.execute({ name: '', projectId: '6cfCcrrCFg2xP94Q' }, mockTodoistApi)).rejects.toThrow('API Error: Section name is required');
|
|
155
|
-
});
|
|
156
|
-
it('should propagate API errors for section updates', async () => {
|
|
157
|
-
const apiError = new Error('API Error: Section not found');
|
|
158
|
-
mockTodoistApi.updateSection.mockRejectedValue(apiError);
|
|
159
|
-
await expect(manageSections.execute({ id: 'non-existent-section', name: 'Updated Name' }, mockTodoistApi)).rejects.toThrow('API Error: Section not found');
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const manageProjects: {
|
|
3
|
-
name: "manage-projects";
|
|
4
|
-
description: string;
|
|
5
|
-
parameters: {
|
|
6
|
-
id: z.ZodOptional<z.ZodString>;
|
|
7
|
-
name: z.ZodString;
|
|
8
|
-
};
|
|
9
|
-
execute(args: {
|
|
10
|
-
name: string;
|
|
11
|
-
id?: string | undefined;
|
|
12
|
-
}, client: import("@doist/todoist-api-typescript").TodoistApi): Promise<{
|
|
13
|
-
content: {
|
|
14
|
-
type: "text";
|
|
15
|
-
text: string;
|
|
16
|
-
}[];
|
|
17
|
-
structuredContent: {
|
|
18
|
-
project: import("@doist/todoist-api-typescript").PersonalProject | import("@doist/todoist-api-typescript").WorkspaceProject;
|
|
19
|
-
operation: string;
|
|
20
|
-
};
|
|
21
|
-
} | {
|
|
22
|
-
content: ({
|
|
23
|
-
type: "text";
|
|
24
|
-
text: string;
|
|
25
|
-
mimeType?: undefined;
|
|
26
|
-
} | {
|
|
27
|
-
type: "text";
|
|
28
|
-
mimeType: string;
|
|
29
|
-
text: string;
|
|
30
|
-
})[];
|
|
31
|
-
structuredContent?: undefined;
|
|
32
|
-
}>;
|
|
33
|
-
};
|
|
34
|
-
export { manageProjects };
|
|
35
|
-
//# sourceMappingURL=manage-projects.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manage-projects.d.ts","sourceRoot":"","sources":["../../src/tools/manage-projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAmBvB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCsB,CAAA;AA+B1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { getToolOutput } from '../mcp-helpers.js';
|
|
3
|
-
import { formatNextSteps } from '../utils/response-builders.js';
|
|
4
|
-
import { ToolNames } from '../utils/tool-names.js';
|
|
5
|
-
const { MANAGE_SECTIONS, ADD_TASKS, FIND_PROJECTS, FIND_TASKS, GET_OVERVIEW } = ToolNames;
|
|
6
|
-
const ArgsSchema = {
|
|
7
|
-
id: z
|
|
8
|
-
.string()
|
|
9
|
-
.min(1)
|
|
10
|
-
.optional()
|
|
11
|
-
.describe('The ID of the project to update. If provided, updates the project. If omitted, creates a new project.'),
|
|
12
|
-
name: z.string().min(1).describe('The name of the project.'),
|
|
13
|
-
};
|
|
14
|
-
const manageProjects = {
|
|
15
|
-
name: ToolNames.MANAGE_PROJECTS,
|
|
16
|
-
description: 'Add a new project or update an existing project. If id is provided, updates the project. If id is omitted, creates a new project.',
|
|
17
|
-
parameters: ArgsSchema,
|
|
18
|
-
async execute(args, client) {
|
|
19
|
-
if (args.id) {
|
|
20
|
-
// Update existing project
|
|
21
|
-
const project = await client.updateProject(args.id, { name: args.name });
|
|
22
|
-
const textContent = generateTextContent({ project, operation: 'updated' });
|
|
23
|
-
return getToolOutput({
|
|
24
|
-
textContent,
|
|
25
|
-
structuredContent: {
|
|
26
|
-
project,
|
|
27
|
-
operation: 'updated',
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
// Create new project
|
|
32
|
-
const project = await client.addProject({ name: args.name });
|
|
33
|
-
const textContent = generateTextContent({ project, operation: 'created' });
|
|
34
|
-
return getToolOutput({
|
|
35
|
-
textContent,
|
|
36
|
-
structuredContent: {
|
|
37
|
-
project,
|
|
38
|
-
operation: 'created',
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
function generateTextContent({ project, operation, }) {
|
|
44
|
-
const action = operation === 'created' ? 'Created' : 'Updated';
|
|
45
|
-
const summary = `${action} project: ${project.name} • id=${project.id}`;
|
|
46
|
-
// Context-aware next steps based on operation
|
|
47
|
-
const nextSteps = [];
|
|
48
|
-
if (operation === 'created') {
|
|
49
|
-
// For new projects, suggest logical setup workflow
|
|
50
|
-
nextSteps.push(`Use ${MANAGE_SECTIONS} to organize this project with sections`);
|
|
51
|
-
nextSteps.push(`Use ${ADD_TASKS} to add your first tasks`);
|
|
52
|
-
nextSteps.push(`Use ${GET_OVERVIEW} with projectId to see updated project structure.`);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// For updated projects, suggest review and management
|
|
56
|
-
nextSteps.push(`Use ${GET_OVERVIEW} with projectId=${project.id} to see project structure`);
|
|
57
|
-
nextSteps.push(`Use ${FIND_PROJECTS} to see all projects with updated name`);
|
|
58
|
-
nextSteps.push(`Use ${FIND_TASKS} with projectId=${project.id} to review existing tasks`);
|
|
59
|
-
}
|
|
60
|
-
const next = formatNextSteps(nextSteps);
|
|
61
|
-
return `${summary}\n${next}`;
|
|
62
|
-
}
|
|
63
|
-
export { manageProjects };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manage-sections.d.ts","sourceRoot":"","sources":["../../src/tools/manage-sections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AA0BvB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CsB,CAAA;AAuC1C,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { getToolOutput } from '../mcp-helpers.js';
|
|
3
|
-
import { formatNextSteps } from '../utils/response-builders.js';
|
|
4
|
-
import { ToolNames } from '../utils/tool-names.js';
|
|
5
|
-
const { ADD_TASKS, FIND_TASKS, GET_OVERVIEW, FIND_SECTIONS } = ToolNames;
|
|
6
|
-
const ArgsSchema = {
|
|
7
|
-
id: z
|
|
8
|
-
.string()
|
|
9
|
-
.min(1)
|
|
10
|
-
.optional()
|
|
11
|
-
.describe('The ID of the section to update. If provided, updates the section. If omitted, creates a new section.'),
|
|
12
|
-
name: z.string().min(1).describe('The name of the section.'),
|
|
13
|
-
projectId: z
|
|
14
|
-
.string()
|
|
15
|
-
.min(1)
|
|
16
|
-
.optional()
|
|
17
|
-
.describe('The ID of the project to add the section to. Required when creating a new section (when id is not provided).'),
|
|
18
|
-
};
|
|
19
|
-
const manageSections = {
|
|
20
|
-
name: ToolNames.MANAGE_SECTIONS,
|
|
21
|
-
description: 'Add a new section to a project or update an existing section. If id is provided, updates the section. If id is omitted, creates a new section (requires projectId).',
|
|
22
|
-
parameters: ArgsSchema,
|
|
23
|
-
async execute(args, client) {
|
|
24
|
-
if (args.id) {
|
|
25
|
-
// Update existing section
|
|
26
|
-
const section = await client.updateSection(args.id, { name: args.name });
|
|
27
|
-
const textContent = generateTextContent({ section, operation: 'updated' });
|
|
28
|
-
return getToolOutput({
|
|
29
|
-
textContent,
|
|
30
|
-
structuredContent: {
|
|
31
|
-
section,
|
|
32
|
-
operation: 'updated',
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
// Create new section - projectId is required
|
|
37
|
-
if (!args.projectId) {
|
|
38
|
-
throw new Error('Error: projectId is required when creating a new section (when id is not provided).');
|
|
39
|
-
}
|
|
40
|
-
const section = await client.addSection({
|
|
41
|
-
name: args.name,
|
|
42
|
-
projectId: args.projectId,
|
|
43
|
-
});
|
|
44
|
-
const textContent = generateTextContent({ section, operation: 'created' });
|
|
45
|
-
return getToolOutput({
|
|
46
|
-
textContent,
|
|
47
|
-
structuredContent: {
|
|
48
|
-
section,
|
|
49
|
-
operation: 'created',
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
function generateTextContent({ section, operation, }) {
|
|
55
|
-
const action = operation === 'created' ? 'Created' : 'Updated';
|
|
56
|
-
const summary = `${action} section: ${section.name} • id=${section.id}`;
|
|
57
|
-
// Workflow-aware next steps based on operation and section context
|
|
58
|
-
const nextSteps = [];
|
|
59
|
-
if (operation === 'created') {
|
|
60
|
-
// For new sections, suggest immediate setup workflow
|
|
61
|
-
nextSteps.push(`Use ${ADD_TASKS} with sectionId=${section.id} to add your first tasks`);
|
|
62
|
-
nextSteps.push(`Use ${FIND_TASKS} with sectionId=${section.id} to verify setup`);
|
|
63
|
-
// Suggest related organization
|
|
64
|
-
if (section.projectId) {
|
|
65
|
-
nextSteps.push(`Use ${GET_OVERVIEW} with projectId=${section.projectId} to see project organization`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
// For updated sections, suggest review and management
|
|
70
|
-
nextSteps.push(`Use ${FIND_TASKS} with sectionId=${section.id} to see existing tasks`);
|
|
71
|
-
nextSteps.push(`Use ${FIND_SECTIONS} to see all sections in this project`);
|
|
72
|
-
// Suggest task updates if section was renamed
|
|
73
|
-
nextSteps.push('Consider updating task descriptions if section purpose changed');
|
|
74
|
-
}
|
|
75
|
-
const next = formatNextSteps(nextSteps);
|
|
76
|
-
return `${summary}\n${next}`;
|
|
77
|
-
}
|
|
78
|
-
export { manageSections };
|