Skip to main content
Glama

Delete Todo

delete_todo
DestructiveIdempotent

Remove a todo item from your task list, with optional dry-run mode to preview changes before deletion.

Instructions

Delete a todo item (supports dry-run)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
resultNo

Implementation Reference

  • Handler functions (handleDeleteTodo, handleDeleteTodoDryRun, handleDeleteTodoLive) that implement the core logic for deleting a todo item, supporting dry-run mode and selector-based resolution.
    async function handleDeleteTodoDryRun(
      input: DeleteTodoInput
    ): Promise<CallToolResult> {
      const todos = await getTodos();
      const selector =
        input.id !== undefined ? { id: input.id } : { query: input.query };
      const outcome = unwrapResolution(
        resolveTodoTargetFromTodos(todos, toResolveInput(selector))
      );
      if (outcome.kind === 'error') return outcome.response;
      if (outcome.kind === 'ambiguous') {
        return buildDryRunMultiple(outcome.previews, outcome.matches.length);
      }
      return buildDeleteResponse(outcome.todo, true);
    }
    
    async function handleDeleteTodoLive(
      input: DeleteTodoInput
    ): Promise<CallToolResult> {
      const selector =
        input.id !== undefined ? { id: input.id } : { query: input.query };
      const outcome = await deleteTodoBySelector(toResolveInput(selector));
      if (outcome.kind === 'error' || outcome.kind === 'ambiguous') {
        return outcome.response;
      }
      return buildDeleteResponse(outcome.todo, false);
    }
    
    async function handleDeleteTodo(
      input: DeleteTodoInput
    ): Promise<CallToolResult> {
      const dryRun = input.dryRun ?? false;
      if (dryRun) {
        return handleDeleteTodoDryRun(input);
      }
      return handleDeleteTodoLive(input);
    }
  • Registration of the 'delete_todo' tool with the MCP server, specifying title, description, schemas, annotations, and handler.
    export function registerDeleteTodo(server: McpServer): void {
      server.registerTool(
        'delete_todo',
        {
          title: 'Delete Todo',
          description: 'Delete a todo item (supports dry-run)',
          inputSchema: DeleteTodoSchema,
          outputSchema: DefaultOutputSchema,
          annotations: {
            readOnlyHint: false,
            idempotentHint: true,
            destructiveHint: true,
          },
        },
        async (input) => {
          try {
            return await handleDeleteTodo(input);
          } catch (err) {
            return createErrorResponse('E_DELETE_TODO', getErrorMessage(err));
          }
        }
      );
    }
  • DeleteTodoSchema: Zod schema defining the input for delete_todo tool, supporting ID or query selector with optional dryRun flag.
    const deleteTodoSelector = buildSelectorSchemas(
      'The ID of the todo to delete',
      'Search text to find a single todo to delete'
    );
    
    export const DeleteTodoSchema: ZodType<DeleteTodoInput> = z.union([
      deleteTodoSelector.byId.extend({
        dryRun: z
          .boolean()
          .optional()
          .describe('Simulate the deletion without changing data'),
      }),
      deleteTodoSelector.byQuery.extend({
        dryRun: z
          .boolean()
          .optional()
          .describe('Simulate the deletion without changing data'),
      }),
    ]);
  • deleteTodoBySelector: Storage helper that resolves a todo by selector and deletes it from the todos list, returning match outcome.
    export async function deleteTodoBySelector(
      input: ResolveTodoInput
    ): Promise<MatchOutcome> {
      return withTodos<MatchOutcome>((todos) => {
        const outcome = unwrapResolution(resolveTodoTargetFromTodos(todos, input));
        if (outcome.kind !== 'match') {
          return { todos, result: outcome };
        }
    
        const remaining = todos.filter((todo) => todo.id !== outcome.todo.id);
        if (remaining.length === todos.length) {
          return {
            todos,
            result: createNotFoundOutcome(outcome.todo.id),
          };
        }
    
        return { todos: remaining, result: { kind: 'match', todo: outcome.todo } };
      });
    }
Behavior4/5

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

The description adds valuable context beyond annotations by mentioning 'supports dry-run', which is not covered by the annotations (readOnlyHint: false, idempotentHint: true, destructiveHint: true). This provides practical behavioral insight, though it could elaborate more on effects or permissions.

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 extremely concise and front-loaded, consisting of a single sentence that directly states the action and a key feature ('supports dry-run'). Every word earns its place with no wasted information.

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

Completeness4/5

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

Given the tool's complexity (destructive operation with no parameters) and the presence of annotations and an output schema, the description is reasonably complete. It covers the core action and a useful feature, though it could benefit from more context on when to use versus siblings.

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 schema fully documents the input (none required). The description does not need to add parameter details, but it implies a todo item is targeted, which aligns with the tool's purpose. Baseline is 4 for zero parameters.

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

Purpose5/5

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

The description clearly states the specific action ('Delete') and resource ('a todo item'), distinguishing it from siblings like 'delete_todos' (plural) and 'complete_todo'. It directly addresses what the tool does without being vague or tautological.

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

Usage Guidelines3/5

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

The description implies usage for deleting a single todo item, but does not explicitly state when to use this tool versus alternatives like 'delete_todos' (for multiple items) or 'complete_todo' (for marking as done). It provides basic context but lacks explicit guidance on exclusions or prerequisites.

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