Skip to main content
Glama

Complete Todo

complete_todo
Idempotent

Mark a todo item as completed to track progress in task management. This tool updates completion status within the Todokit MCP Server's local JSON storage.

Instructions

Set completion status for a todo item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
resultNo

Implementation Reference

  • The main handler function that processes the complete_todo tool input: resolves the todo selector, calls the storage mutation, and constructs the tool response.
    async function handleCompleteTodo(
      input: CompleteTodoInput
    ): Promise<CallToolResult> {
      const targetCompleted = input.completed ?? true;
      const selector =
        input.id !== undefined ? { id: input.id } : { query: input.query };
      const outcome = await completeTodoBySelector(
        toResolveInput(selector),
        targetCompleted
      );
      return buildOutcomeResponse(outcome, targetCompleted);
    }
  • Zod schema for CompleteTodoInput: union of selector by ID or query, with optional 'completed' boolean.
    const completeTodoSelector = buildSelectorSchemas(
      'The ID of the todo to complete',
      'Search text to find a single todo to complete'
    );
    
    export const CompleteTodoSchema: ZodType<CompleteTodoInput> = z.union([
      completeTodoSelector.byId.extend({
        completed: z
          .boolean()
          .optional()
          .describe('Set completion status (default: true)'),
      }),
      completeTodoSelector.byQuery.extend({
        completed: z
          .boolean()
          .optional()
          .describe('Set completion status (default: true)'),
      }),
    ]);
  • Registers the complete_todo tool on the MCP server with input/output schemas, metadata, and error-handling wrapper around the handler.
    export function registerCompleteTodo(server: McpServer): void {
      server.registerTool(
        'complete_todo',
        {
          title: 'Complete Todo',
          description: 'Set completion status for a todo item',
          inputSchema: CompleteTodoSchema,
          outputSchema: DefaultOutputSchema,
          annotations: {
            readOnlyHint: false,
            idempotentHint: true,
          },
        },
        async (input) => {
          try {
            return await handleCompleteTodo(input);
          } catch (err) {
            return createErrorResponse('E_COMPLETE_TODO', getErrorMessage(err));
          }
        }
      );
    }
  • Storage layer function that resolves the todo selector, toggles completion status if needed, handles 'already' case, and persists changes via withTodos.
    export async function completeTodoBySelector(
      input: ResolveTodoInput,
      completed: boolean
    ): Promise<CompleteTodoOutcome> {
      return withTodos<CompleteTodoOutcome>((todos) => {
        const outcome = unwrapResolution(resolveTodoTargetFromTodos(todos, input));
        if (outcome.kind !== 'match') {
          return { todos, result: outcome };
        }
    
        if (outcome.todo.completed === completed) {
          return { todos, result: { kind: 'already', todo: outcome.todo } };
        }
    
        const updated = applyUpdateToTodos(todos, outcome.todo.id, { completed });
        if (!updated.result) {
          return {
            todos,
            result: createNotFoundOutcome(outcome.todo.id),
          };
        }
    
        return {
          todos: updated.todos,
          result: { kind: 'match', todo: updated.result },
        };
      });
    }
Behavior3/5

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

Annotations indicate readOnlyHint=false (implying mutation) and idempotentHint=true (safe for retries). The description adds minimal behavioral context by implying a status change, but it doesn't disclose details like whether this toggles status, sets a specific value, requires authentication, or has side effects. With annotations covering basic safety, the description adds some value but lacks rich behavioral insights.

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, efficient sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every part of the sentence contributes to understanding the tool's purpose.

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 the tool's complexity (a mutation with no parameters) and the presence of annotations (readOnlyHint=false, idempotentHint=true) and an output schema, the description is minimally adequate. It states what the tool does but lacks context on usage, behavioral nuances, or how it differs from siblings. With annotations and output schema handling some structured info, the description meets a basic threshold but has clear gaps.

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?

The input schema has 0 parameters with 100% coverage, meaning no parameters are documented in the schema. The description doesn't add parameter details, but since there are no parameters, this is acceptable. It implies the tool operates on a todo item without specifying how (e.g., via ID), but the baseline for 0 parameters is 4, as the description doesn't need to compensate for missing schema info.

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 'Set completion status for a todo item' clearly states the action (set completion status) and resource (todo item), but it's vague about what 'completion status' means (e.g., marking as done vs. toggling) and doesn't distinguish it from sibling tools like 'update_todo', which might also handle status updates. It avoids tautology by not just restating the name/title.

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), exclusions (e.g., not for creating todos), or comparisons to siblings like 'update_todo' that might overlap in functionality. This leaves the agent without context for tool selection.

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