Skip to content

Commit ba7fb5b

Browse files
authored
Merge pull request #534 from rumpl/use-category
Use the category when checking if we should add todos in the sidebar
2 parents b36a8b3 + 42be11d commit ba7fb5b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/tui/page/chat/chat.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,12 +255,10 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
255255
cmd := p.messages.AddToolResult(msg, types.ToolStatusCompleted)
256256

257257
// Check if this is a todo-related tool call and update sidebar
258-
// Only update after successful execution (in response, not during call)
259-
toolName := msg.ToolCall.Function.Name
260-
if toolName == "create_todo" || toolName == "create_todos" ||
261-
toolName == "update_todo" || toolName == "list_todos" {
258+
if msg.ToolDefinition.Category == "todo" {
262259
// Only update if the response doesn't contain an error
263260
// Response starting with "Error calling tool:" indicates failure
261+
// TODO: We should maybe use the mcp types, they have an "IsError" field.
264262
if len(msg.Response) < 19 || msg.Response[:19] != "Error calling tool:" {
265263
_ = p.sidebar.SetTodos(msg.ToolCall)
266264
}

0 commit comments

Comments
 (0)