Skip to content

Commit 02cbf37

Browse files
New, clearer, more explicit tool interface
1 parent d6ef54c commit 02cbf37

File tree

8 files changed

+1227
-1218
lines changed

8 files changed

+1227
-1218
lines changed

README.md

Lines changed: 135 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -172,27 +172,30 @@ Add the following to your MCP client's configuration:
172172

173173
## Available Operations
174174

175-
The TaskManager now uses a consolidated API with two main tools:
175+
The TaskManager now uses a direct tools interface with specific, purpose-built tools for each operation:
176176

177-
### `project` Tool
178-
Manages high-level projects with multiple tasks.
177+
### Project Management Tools
179178

180-
**Actions:**
181-
- `list`: List all projects in the system
182-
- `create`: Create a new project with initial tasks
183-
- `delete`: Remove a project
184-
- `add_tasks`: Add new tasks to an existing project
185-
- `finalize`: Finalize a project after all tasks are done and approved
179+
- `list_projects`: Lists all projects in the system
180+
- `read_project`: Gets details about a specific project
181+
- `create_project`: Creates a new project with initial tasks
182+
- `delete_project`: Removes a project
183+
- `add_tasks_to_project`: Adds new tasks to an existing project
184+
- `finalize_project`: Finalizes a project after all tasks are done
186185

187-
### `task` Tool
188-
Manages individual tasks within projects.
186+
### Task Management Tools
189187

190-
**Actions:**
191-
- `read`: Get details of a specific task
192-
- `update`: Modify a task's properties (title, description, status)
193-
- `delete`: Remove a task from a project
188+
- `list_tasks`: Lists all tasks for a specific project
189+
- `read_task`: Gets details of a specific task
190+
- `create_task`: Creates a new task in a project
191+
- `update_task`: Modifies a task's properties (title, description, status)
192+
- `delete_task`: Removes a task from a project
193+
- `approve_task`: Approves a completed task
194+
- `get_next_task`: Gets the next pending task in a project
195+
- `mark_task_done`: Marks a task as completed with details
196+
197+
### Task Status and Workflows
194198

195-
### Task Status
196199
Tasks have a status field that can be one of:
197200
- `not started`: Task has not been started yet
198201
- `in progress`: Task is currently being worked on
@@ -204,12 +207,24 @@ The system enforces the following rules for task status transitions:
204207
- From `not started`: Can only move to `in progress`
205208
- From `in progress`: Can move to either `done` or back to `not started`
206209
- From `done`: Can move back to `in progress` if additional work is needed
207-
- A task cannot skip states (e.g., cannot go directly from "not started" to "done")
208-
- When a task is marked as "done", the `completedDetails` field is required
210+
- When a task is marked as "done", the `completedDetails` field should be provided to document what was completed
209211
- Approved tasks cannot be modified
210212

211213
These rules help maintain the integrity of task progress and ensure proper documentation of completed work.
212214

215+
### Usage Workflow
216+
217+
A typical workflow for an LLM using this task manager would be:
218+
219+
1. `create_project`: Start a project with initial tasks
220+
2. `get_next_task`: Get the first pending task
221+
3. Work on the task
222+
4. `mark_task_done`: Mark the task as complete with details
223+
5. Wait for approval (user must call `approve_task` through the CLI)
224+
6. `get_next_task`: Get the next pending task
225+
7. Repeat steps 3-6 until all tasks are complete
226+
8. `finalize_project`: Complete the project (requires user approval)
227+
213228
### CLI Commands
214229

215230
#### Task Approval
@@ -248,44 +263,113 @@ This command displays information about all projects in the system or a specific
248263
## Example Usage
249264

250265
### Creating a Project with Tasks
251-
```json
252-
{
253-
"tool": "project",
254-
"action": "create",
255-
"arguments": {
256-
"initialPrompt": "Write a blog post about cats",
257-
"tasks": [
258-
{ "title": "Research cat breeds", "description": "Find information about 5 popular cat breeds" },
259-
{ "title": "Create outline", "description": "Organize main points and structure of the blog" },
260-
{ "title": "Write draft", "description": "Write the first draft of the blog post" },
261-
{ "title": "Edit and finalize", "description": "Proofread and make final edits to the blog post" }
262-
]
263-
}
264-
}
266+
267+
```javascript
268+
// Example of how an LLM would use the create_project tool
269+
const createProjectResult = await toolManager.callFunction('create_project', {
270+
initialPrompt: "Create a website for a small business",
271+
projectPlan: "We'll create a responsive website with Home, About, Services, and Contact pages",
272+
tasks: [
273+
{
274+
title: "Set up project structure",
275+
description: "Create repository and initialize with basic HTML/CSS/JS files"
276+
},
277+
{
278+
title: "Design homepage",
279+
description: "Create responsive homepage with navigation and hero section"
280+
},
281+
{
282+
title: "Implement about page",
283+
description: "Create about page with company history and team section"
284+
}
285+
]
286+
});
287+
288+
// Response will include:
289+
// {
290+
// status: "planned",
291+
// projectId: "proj-1234",
292+
// totalTasks: 3,
293+
// tasks: [
294+
// { id: "task-1", title: "Set up project structure", ... },
295+
// { id: "task-2", title: "Design homepage", ... },
296+
// { id: "task-3", title: "Implement about page", ... }
297+
// ],
298+
// message: "Project created with 3 tasks"
299+
// }
265300
```
266301

267-
### Updating a Task Status
268-
```json
269-
{
270-
"tool": "task",
271-
"action": "update",
272-
"arguments": {
273-
"projectId": "proj-1",
274-
"taskId": "task-1",
275-
"status": "in progress"
276-
}
277-
}
302+
### Getting the Next Task
303+
304+
```javascript
305+
// Example of how an LLM would use the get_next_task tool
306+
const nextTaskResult = await toolManager.callFunction('get_next_task', {
307+
projectId: "proj-1234"
308+
});
309+
310+
// Response will include:
311+
// {
312+
// status: "next_task",
313+
// task: {
314+
// id: "task-1",
315+
// title: "Set up project structure",
316+
// description: "Create repository and initialize with basic HTML/CSS/JS files",
317+
// status: "not started",
318+
// approved: false
319+
// },
320+
// message: "Retrieved next task"
321+
// }
278322
```
279323

324+
### Marking a Task as Done
325+
326+
```javascript
327+
// Example of how an LLM would use the mark_task_done tool
328+
const markDoneResult = await toolManager.callFunction('mark_task_done', {
329+
projectId: "proj-1234",
330+
taskId: "task-1",
331+
completedDetails: "Created repository at github.com/example/business-site and initialized with HTML5 boilerplate, CSS reset, and basic JS structure."
332+
});
333+
334+
// Response will include:
335+
// {
336+
// status: "task_marked_done",
337+
// task: {
338+
// id: "task-1",
339+
// title: "Set up project structure",
340+
// status: "done",
341+
// approved: false,
342+
// completedDetails: "Created repository at github.com/example/business-site and initialized with HTML5 boilerplate, CSS reset, and basic JS structure."
343+
// },
344+
// message: "Task marked as done"
345+
// }
346+
```
347+
348+
### Approving a Task (CLI-only operation)
349+
350+
This operation can only be performed by the user through the CLI:
351+
352+
```bash
353+
npm run approve-task -- proj-1234 task-1
354+
```
355+
356+
After approval, the LLM can check the task status using `read_task` or get the next task using `get_next_task`.
357+
280358
### Finalizing a Project
281-
```json
282-
{
283-
"tool": "project",
284-
"action": "finalize",
285-
"arguments": {
286-
"projectId": "proj-1"
287-
}
288-
}
359+
360+
```javascript
361+
// Example of how an LLM would use the finalize_project tool
362+
// (Called after all tasks are done and approved)
363+
const finalizeResult = await toolManager.callFunction('finalize_project', {
364+
projectId: "proj-1234"
365+
});
366+
367+
// Response will include:
368+
// {
369+
// status: "project_finalized",
370+
// projectId: "proj-1234",
371+
// message: "Project has been finalized"
372+
// }
289373
```
290374

291375
## Status Codes and Responses

0 commit comments

Comments
 (0)