Skip to main content
Glama

update_todo

Modify an existing task by updating its title, description, completion status, priority, or tags using the UUID for identification in the Todo List MCP Server.

Instructions

Update an existing todo item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
completedNoMark as completed or not
descriptionNoNew description
idYesUUID of the todo to update
priorityNoNew priority level
tagsNoNew tags
titleNoNew title

Implementation Reference

  • The handler function for the 'update_todo' tool. It sanitizes and validates the input using UpdateTodoSchema, calls the todoService.updateTodo method, and returns a formatted success or error response.
    async handleUpdateTodo(request: CallToolRequest): Promise<CallToolResult> { try { const sanitizedArgs = sanitizeInput(request.params.arguments); const validatedRequest = validateData(UpdateTodoSchema, sanitizedArgs); const todo = this.todoService.updateTodo(validatedRequest); if (!todo) { return { content: [ { type: "text", text: `❌ Todo com ID ${validatedRequest.id} não encontrado`, }, ], }; } return { content: [ { type: "text", text: `✅ Todo atualizado com sucesso!\n\n${JSON.stringify(todo, null, 2)}`, }, ], }; } catch (error) { const errorResponse = createErrorResponse(error, "atualizar todo"); return { content: [ { type: "text", text: `❌ ${errorResponse.error}\n${errorResponse.details || ""}`, }, ], }; } }
  • Zod schema defining the input structure and validation rules for the 'update_todo' tool parameters.
    export const UpdateTodoSchema = z.object({ id: UuiSchema, title: NonEmptyStringSchema.max(200, 'Título não pode exceder 200 caracteres').optional(), description: z.string().max(500).optional(), completed: z.boolean().optional(), priority: z.enum(['low', 'medium', 'high']).optional(), tags: z.array(z.string().min(1).max(50)).max(10).optional() });
  • Tool registration definition for 'update_todo' including name, description, and JSON schema for input validation in MCP.
    { name: "update_todo", description: "Update an existing todo item", inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid", description: "UUID of the todo to update", }, title: { type: "string", minLength: 1, maxLength: 200, description: "New title", }, description: { type: "string", maxLength: 1000, description: "New description", }, completed: { type: "boolean", description: "Mark as completed or not", }, priority: { type: "string", enum: ["low", "medium", "high"], description: "New priority level", }, tags: { type: "array", items: { type: "string", minLength: 1, maxLength: 50 }, maxItems: 10, description: "New tags", }, }, required: ["id"], }, },
  • Service method implementing the core update logic: validates input, finds the todo by ID, applies partial updates, and persists to in-memory store.
    updateTodo(request: UpdateTodoRequest): Todo | null { // Validar entrada const validatedRequest = validateData(UpdateTodoSchema, request); const existingTodo = this.todos.get(validatedRequest.id); if (!existingTodo) { return null; } const updatedTodo: Todo = { ...existingTodo, ...(validatedRequest.title !== undefined && { title: validatedRequest.title }), ...(validatedRequest.description !== undefined && { description: validatedRequest.description }), ...(validatedRequest.priority !== undefined && { priority: validatedRequest.priority }), ...(validatedRequest.tags !== undefined && { tags: validatedRequest.tags }), ...(validatedRequest.completed !== undefined && { completed: validatedRequest.completed, completedAt: validatedRequest.completed ? new Date() : undefined }) }; this.todos.set(validatedRequest.id, updatedTodo); return updatedTodo; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/glaucia86/todo-list-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server