Skip to content

Commit aeac707

Browse files
committed
feat: Enhance update_todo_list schema description and improve tool name validation
1 parent 0e110a2 commit aeac707

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

src/core/prompts/tools/schemas/update-todo-list-schema.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,32 @@ import { BaseToolSchema } from "./base-tool-schema"
44
export function generateUpdateTodoListSchema(args: ToolArgs): BaseToolSchema {
55
const schema: BaseToolSchema = {
66
name: "update_todo_list",
7-
description:
8-
"Replaces the current TODO list with an updated one. This is used for tracking task progress, allows for updating multiple statuses at once, and supports adding new tasks as they arise.",
7+
description: `**Description:**
8+
Replace the entire TODO list with an updated checklist reflecting the current state. Always provide the full list; the system will overwrite the previous one. This tool is designed for step-by-step task tracking, allowing you to confirm completion of each step before updating, update multiple task statuses at once (e.g., mark one as completed and start the next), and dynamically add new todos discovered during long or complex tasks.
9+
10+
**Checklist Format:**
11+
- Use a single-level markdown checklist (no nesting or subtasks).
12+
- List todos in the intended execution order.
13+
- Status options:
14+
[ ] Task description (pending)
15+
[x] Task description (completed)
16+
[-] Task description (in progress)
17+
18+
**Status Rules:**
19+
[ ] = pending (not started)
20+
[x] = completed (fully finished, no unresolved issues)
21+
[-] = in_progress (currently being worked on)
22+
23+
**Core Principles:**
24+
- Before updating, always confirm which todos have been completed since the last update.
25+
- You may update multiple statuses in a single update (e.g., mark the previous as completed and the next as in progress).
26+
- When a new actionable item is discovered during a long or complex task, add it to the todo list immediately.
27+
- Do not remove any unfinished todos unless explicitly instructed.
28+
- Always retain all unfinished tasks, updating their status as needed.
29+
- Only mark a task as completed when it is fully accomplished (no partials, no unresolved dependencies).
30+
- If a task is blocked, keep it as in_progress and add a new todo describing what needs to be resolved.
31+
- Remove tasks only if they are no longer relevant or if the user requests deletion.
32+
`,
933
parameters: [
1034
{
1135
name: "todos",

src/core/task/tool-call-helper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ export class StreamingToolCallProcessor {
163163
}
164164
// the index of GPT-5 tool_call not start by 0
165165
const toolCall = this.accumulatedToolCalls[index]
166-
const isValidToolName =
167-
toolCall?.function?.name && toolRegistry.isToolSupported(toolCall.function.name as ToolName)
166+
const toolName = toolCall?.function?.name as ToolName
167+
const isValidToolName = toolName && toolRegistry.isToolSupported(toolName)
168168

169169
const result: ToolCallParam = {
170170
providerType: "openai",
171-
toolName: isValidToolName ? toolCall.function.name : "",
171+
toolName: isValidToolName ? toolName : "",
172172
toolUserId: toolCall?.id || undefined,
173173
chunkContent: xmlOutput,
174174
originContent: this.accumulatedToolCalls,

0 commit comments

Comments
 (0)