MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / validateTodos

Function validateTodos

src/core/tools/UpdateTodoListTool.ts:208–219  ·  view source on GitHub ↗
(todos: any[])

Source from the content-addressed store, hash-verified

206}
207
208function validateTodos(todos: any[]): { valid: boolean; error?: string } {
209 if (!Array.isArray(todos)) return { valid: false, error: "todos must be an array" }
210 for (const [i, t] of todos.entries()) {
211 if (!t || typeof t !== "object") return { valid: false, error: `Item ${i + 1} is not an object` }
212 if (!t.id || typeof t.id !== "string") return { valid: false, error: `Item ${i + 1} is missing id` }
213 if (!t.content || typeof t.content !== "string")
214 return { valid: false, error: `Item ${i + 1} is missing content` }
215 if (t.status && !todoStatusSchema.options.includes(t.status as TodoStatus))
216 return { valid: false, error: `Item ${i + 1} has invalid status` }
217 }
218 return { valid: true }
219}
220
221export const updateTodoListTool = new UpdateTodoListTool()

Callers 1

executeMethod · 0.85

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected