Skip to main content
Glama
glaucia86
by glaucia86

update_todo

Modify existing todo items by updating titles, descriptions, completion status, priority levels, or tags to keep tasks current and organized.

Instructions

Update an existing todo item

Input Schema

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

Implementation Reference

  • The main tool handler for 'update_todo' that sanitizes and validates input using UpdateTodoSchema, calls the todo service to update the todo, handles errors, and returns a formatted MCP 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, including optional fields for partial updates.
    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()
    });
  • Registration of the 'update_todo' tool in the TOOL_DEFINITIONS array, including name, description, and JSON schema for input validation.
    {
      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"],
      },
    },
  • Core service method that validates the update request, merges partial updates into the existing todo, updates the in-memory store, and returns the updated todo or null if not found.
    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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Update an existing todo item' implies a mutation operation but reveals nothing about permissions, side effects, error handling, or response format. It doesn't indicate whether all fields are optional (beyond required 'id'), if updates are atomic, or what happens with invalid data. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words. It's front-loaded with the core action and resource, making it immediately scannable. Every word earns its place by establishing the tool's fundamental purpose without unnecessary elaboration or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (mutation with 6 parameters), lack of annotations, and absence of an output schema, the description is insufficiently complete. It doesn't address behavioral aspects like error conditions, idempotency, or response structure, nor does it clarify parameter interactions (e.g., partial updates). For a mutation tool in this context, more comprehensive guidance is needed to support reliable agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with each parameter well-documented in the schema (e.g., 'id' as UUID, 'priority' with enum values). The description adds no parameter-specific information beyond the generic 'update' context, so it doesn't enhance understanding of individual parameters. This meets the baseline of 3 for high schema coverage, but doesn't compensate with additional semantic context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('an existing todo item'), making the purpose immediately understandable. It distinguishes from siblings like 'create_todo' (new items) and 'delete_todo' (removal), though it doesn't explicitly differentiate from other update-like operations since none exist in the sibling list. The verb+resource combination is specific but lacks nuance about what aspects can be updated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing todo ID), contrast with 'create_todo' for new items, or specify scenarios where partial updates are allowed. With siblings like 'get_todo' and 'list_todos' available, the absence of usage context leaves the agent to infer appropriate application.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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