Skip to main content
Glama

Update Todo

update_todo
Idempotent

Modify todo items by updating fields, searching content, or managing tags to keep tasks organized and current.

Instructions

Update fields on a todo item (supports search and tag ops)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
resultNo

Implementation Reference

  • Core handler function that processes the update_todo input, resolves the todo selector, builds the update payload, calls the storage update function, and constructs the tool response.
    async function handleUpdateTodo(
      input: UpdateTodoInput
    ): Promise<CallToolResult> {
      const selector =
        input.id !== undefined ? { id: input.id } : { query: input.query };
      const outcome = await updateTodoBySelector(toResolveInput(selector), (todo) =>
        buildUpdatePayload(todo, input)
      );
      if (outcome.kind === 'error' || outcome.kind === 'ambiguous') {
        return outcome.response;
      }
      if (outcome.kind === 'no_updates') {
        return createErrorResponse('E_BAD_REQUEST', 'No fields provided to update');
      }
    
      return createToolResponse({
        ok: true,
        result: {
          item: outcome.todo,
          summary: `Updated todo "${outcome.todo.title}"`,
          nextActions: ['list_todos', 'complete_todo'],
        },
      });
    }
  • Defines the input schema for update_todo tool, including selector (by ID or query) and update fields like title, description, status, tags with clear and tagOps support.
    const updateTodoSelector = buildSelectorSchemas(
      'The ID of the todo to update',
      'Search text to find a single todo to update'
    );
    
    const UpdateTodoFieldsSchema = {
      title: z.string().min(1).max(200).optional().describe('New title'),
      description: z.string().max(2000).optional().describe('New description'),
      completed: z.boolean().optional().describe('Completion status'),
      priority: z
        .enum(['low', 'normal', 'high'])
        .optional()
        .describe('New priority level'),
      dueDate: IsoDateSchema.optional().describe('New due date (ISO format)'),
      tags: z.array(TagSchema).max(50).optional().describe('New tags'),
      clearFields: z
        .array(z.enum(['description', 'dueDate', 'tags']))
        .max(3)
        .optional()
        .describe('Fields to clear'),
      tagOps: TagOpsSchema.optional().describe('Tag modifications to apply'),
    };
    
    export const UpdateTodoSchema: ZodType<UpdateTodoInput> = z.union([
      updateTodoSelector.byId.extend(UpdateTodoFieldsSchema),
      updateTodoSelector.byQuery.extend(UpdateTodoFieldsSchema),
    ]);
  • Registers the 'update_todo' tool on the MCP server with title, description, input/output schemas, annotations, and the async handler function.
    export function registerUpdateTodo(server: McpServer): void {
      server.registerTool(
        'update_todo',
        {
          title: 'Update Todo',
          description: 'Update fields on a todo item (supports search and tag ops)',
          inputSchema: UpdateTodoSchema,
          outputSchema: DefaultOutputSchema,
          annotations: {
            readOnlyHint: false,
            idempotentHint: true,
          },
        },
        async (input) => {
          try {
            return await handleUpdateTodo(input);
          } catch (err) {
            return createErrorResponse('E_UPDATE_TODO', getErrorMessage(err));
          }
        }
      );
    }
  • Imports and calls registerUpdateTodo as part of registering all tools.
    import { registerUpdateTodo } from './update_todo.js';
    
    export function registerAllTools(server: McpServer): void {
      registerAddTodo(server);
      registerAddTodos(server);
      registerListTodos(server);
      registerUpdateTodo(server);
  • Helper function that resolves a todo by selector, builds updates via callback, applies the update if changes exist, and returns the outcome used by the handler.
    export async function updateTodoBySelector(
      input: ResolveTodoInput,
      buildUpdates: (todo: Todo) => TodoUpdate | null
    ): Promise<UpdateTodoOutcome> {
      return withTodos<UpdateTodoOutcome>((todos) => {
        const outcome = unwrapResolution(resolveTodoTargetFromTodos(todos, input));
        if (outcome.kind !== 'match') {
          return { todos, result: outcome };
        }
    
        const updates = buildUpdates(outcome.todo);
        if (!updates || Object.keys(updates).length === 0) {
          return { todos, result: { kind: 'no_updates' } };
        }
    
        const updated = applyUpdateToTodos(todos, outcome.todo.id, updates);
        if (!updated.result) {
          return {
            todos,
            result: createNotFoundOutcome(outcome.todo.id),
          };
        }
    
        return {
          todos: updated.todos,
          result: { kind: 'match', todo: updated.result },
        };
      });
Behavior4/5

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

Annotations already declare readOnlyHint=false (mutation) and idempotentHint=true (safe to retry). The description adds value by mentioning 'search and tag ops' which suggests this tool might have search capabilities and tag operations beyond basic field updates. However, it doesn't specify authentication requirements, rate limits, or what happens to existing fields not mentioned in updates.

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

Conciseness4/5

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

The description is extremely concise (one sentence) and front-loaded with the core purpose. However, the phrase 'supports search and tag ops' is ambiguous and doesn't clearly earn its place in such a brief description - it creates confusion rather than adding clarity.

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

Completeness3/5

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

Given that there's an output schema (which handles return values), 0 parameters (minimal complexity), and annotations covering basic behavioral traits, the description is somewhat complete. However, the mention of 'search and tag ops' creates confusion about what this tool actually does versus siblings, and the empty parameter schema contradicts the implied capabilities.

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

Parameters4/5

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

With 0 parameters and 100% schema description coverage, the baseline would be 4. The description adds context about 'search and tag ops' which suggests this tool might have implicit parameters or capabilities not reflected in the empty schema. However, this is somewhat confusing given the empty parameter schema.

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

Purpose3/5

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

The description states the tool updates fields on a todo item, which is a clear verb+resource combination. However, it doesn't distinguish this from sibling tools like 'complete_todo' or 'add_todo' - the mention of 'search and tag ops' is vague and doesn't clarify what makes this tool unique.

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?

No explicit guidance on when to use this tool versus alternatives like 'complete_todo' or 'add_todo'. The mention of 'search and tag ops' is ambiguous and doesn't provide clear context for tool selection. The description lacks any when/when-not statements or alternative recommendations.

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/j0hanz/todokit-mcp-server'

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