request_planning
Register user requests and plan associated tasks with structured workflows. Initiate task execution, track progress, and ensure user approval at each step to manage and complete requests efficiently.
Instructions
Register a new user request and plan its associated tasks. You must provide 'originalRequest' and 'tasks', and optionally 'splitDetails'.
This tool initiates a new workflow for handling a user's request. The workflow is as follows:
Use 'request_planning' to register a request and its tasks.
After adding tasks, you MUST use 'get_next_task' to retrieve the first task. A progress table will be displayed.
Use 'get_next_task' to retrieve the next uncompleted task.
IMPORTANT: After marking a task as done, the assistant MUST NOT proceed to another task without the user's approval. The user must explicitly approve the completed task using 'approve_task_completion'. A progress table will be displayed before each approval request.
Once a task is approved, you can proceed to 'get_next_task' again to fetch the next pending task.
Repeat this cycle until all tasks are done.
After all tasks are completed (and approved), 'get_next_task' will indicate that all tasks are done and that the request awaits approval for full completion.
The user must then approve the entire request's completion using 'approve_request_completion'. If the user does not approve and wants more tasks, you can again use 'request_planning' to add new tasks and continue the cycle.
The critical point is to always wait for user approval after completing each task and after all tasks are done, wait for request completion approval. Do not proceed automatically.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| originalRequest | Yes | ||
| splitDetails | No | ||
| tasks | Yes |
Implementation Reference
- index.ts:369-414 (handler)Core handler function that executes the tool logic: generates IDs, creates tasks, persists to JSON file, generates progress table.public async requestPlanning( originalRequest: string, tasks: { title: string; description: string }[], splitDetails?: string ) { await this.loadTasks(); this.requestCounter += 1; const requestId = `req-${this.requestCounter}`; const newTasks: Task[] = []; for (const taskDef of tasks) { this.taskCounter += 1; newTasks.push({ id: `task-${this.taskCounter}`, title: taskDef.title, description: taskDef.description, done: false, approved: false, completedDetails: "", }); } this.data.requests.push({ requestId, originalRequest, splitDetails: splitDetails || originalRequest, tasks: newTasks, completed: false, }); await this.saveTasks(); const progressTable = this.formatTaskProgressTable(requestId); return { status: "planned", requestId, totalTasks: newTasks.length, tasks: newTasks.map((t) => ({ id: t.id, title: t.title, description: t.description, })), message: `Tasks have been successfully added. Please use 'get_next_task' to retrieve the first task.\n${progressTable}`, }; }
- index.ts:41-50 (schema)Zod schema used for input validation of the request_planning tool parameters.const RequestPlanningSchema = z.object({ originalRequest: z.string(), splitDetails: z.string().optional(), tasks: z.array( z.object({ title: z.string(), description: z.string(), }) ), });
- index.ts:101-134 (registration)Definition of the REQUEST_PLANNING_TOOL object with name, description, and input schema.const REQUEST_PLANNING_TOOL: Tool = { name: "request_planning", description: "Register a new user request and plan its associated tasks. You must provide 'originalRequest' and 'tasks', and optionally 'splitDetails'.\n\n" + "This tool initiates a new workflow for handling a user's request. The workflow is as follows:\n" + "1. Use 'request_planning' to register a request and its tasks.\n" + "2. After adding tasks, you MUST use 'get_next_task' to retrieve the first task. A progress table will be displayed.\n" + "3. Use 'get_next_task' to retrieve the next uncompleted task.\n" + "4. **IMPORTANT:** After marking a task as done, the assistant MUST NOT proceed to another task without the user's approval. The user must explicitly approve the completed task using 'approve_task_completion'. A progress table will be displayed before each approval request.\n" + "5. Once a task is approved, you can proceed to 'get_next_task' again to fetch the next pending task.\n" + "6. Repeat this cycle until all tasks are done.\n" + "7. After all tasks are completed (and approved), 'get_next_task' will indicate that all tasks are done and that the request awaits approval for full completion.\n" + "8. The user must then approve the entire request's completion using 'approve_request_completion'. If the user does not approve and wants more tasks, you can again use 'request_planning' to add new tasks and continue the cycle.\n\n" + "The critical point is to always wait for user approval after completing each task and after all tasks are done, wait for request completion approval. Do not proceed automatically.", inputSchema: { type: "object", properties: { originalRequest: { type: "string" }, splitDetails: { type: "string" }, tasks: { type: "array", items: { type: "object", properties: { title: { type: "string" }, description: { type: "string" }, }, required: ["title", "description"], }, }, }, required: ["originalRequest", "tasks"], }, };
- index.ts:683-697 (registration)Registration of the request_planning tool (as REQUEST_PLANNING_TOOL) in the list of available tools returned by ListToolsRequest.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ REQUEST_PLANNING_TOOL, GET_NEXT_TASK_TOOL, MARK_TASK_DONE_TOOL, APPROVE_TASK_COMPLETION_TOOL, APPROVE_REQUEST_COMPLETION_TOOL, OPEN_TASK_DETAILS_TOOL, LIST_REQUESTS_TOOL, ADD_TASKS_TO_REQUEST_TOOL, UPDATE_TASK_TOOL, DELETE_TASK_TOOL, ], }));
- index.ts:703-717 (handler)Entry point handler for tool calls to 'request_planning': validates input and delegates to TaskManagerServer.requestPlanning method.case "request_planning": { const parsed = RequestPlanningSchema.safeParse(args); if (!parsed.success) { throw new Error(`Invalid arguments: ${parsed.error}`); } const { originalRequest, tasks, splitDetails } = parsed.data; const result = await taskManagerServer.requestPlanning( originalRequest, tasks, splitDetails ); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }