Skip to main content
Glama

Toggle Todo

toggle_todo

Change the completion status of a specific todo item by its ID in the MCP Todo server's persistent task list.

Instructions

Toggle a todo by id

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Executes the toggle_todo tool: loads todos, finds the todo by ID, flips its 'done' status, saves the list, and returns a confirmation or error message.
    async ({ id }) => {
      const todos = await readTodos();
      const i = todos.findIndex((t) => t.id === id);
      if (i === -1)
        return { content: [{ type: "text", text: `No todo with id ${id}` }] };
      const todo = todos[i]!;
      todo.done = !todo.done;
      await writeTodos(todos);
      return {
        content: [
          {
            type: "text",
            text: `Toggled #${id} to ${todo.done ? "done" : "not done"}`,
          },
        ],
      };
    }
  • Tool metadata and input schema for toggle_todo: requires a positive integer 'id'.
    {
      title: "Toggle Todo",
      description: "Toggle a todo by id",
      inputSchema: { id: z.number().int().positive() },
    },
  • src/server.ts:88-112 (registration)
    Registers the toggle_todo tool on the MCP server with schema and handler function.
    server.registerTool(
      "toggle_todo",
      {
        title: "Toggle Todo",
        description: "Toggle a todo by id",
        inputSchema: { id: z.number().int().positive() },
      },
      async ({ id }) => {
        const todos = await readTodos();
        const i = todos.findIndex((t) => t.id === id);
        if (i === -1)
          return { content: [{ type: "text", text: `No todo with id ${id}` }] };
        const todo = todos[i]!;
        todo.done = !todo.done;
        await writeTodos(todos);
        return {
          content: [
            {
              type: "text",
              text: `Toggled #${id} to ${todo.done ? "done" : "not done"}`,
            },
          ],
        };
      }
    );
  • Helper functions readTodos and writeTodos for loading and saving the todo list from/to JSON file, used by the toggle_todo handler.
    async function readTodos(): Promise<Todo[]> {
      try {
        const s = await fs.readFile(DB_PATH, "utf-8");
        return JSON.parse(s);
      } catch {
        return [];
      }
    }
    async function writeTodos(todos: Todo[]) {
      await fs.writeFile(DB_PATH, JSON.stringify(todos, null, 2), "utf-8");
    }
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. It mentions 'toggle' but doesn't disclose behavioral traits such as what 'toggle' does (e.g., changes completion status), whether it's idempotent, or any side effects. This leaves critical gaps for a mutation tool.

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—a single sentence with zero waste. It's front-loaded and efficiently states the core action, though this brevity contributes to gaps in other dimensions.

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 (a mutation with no annotations, 0% schema coverage, and no output schema), the description is incomplete. It lacks details on behavior, parameter meaning, and expected outcomes, making it inadequate for reliable agent use.

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

Parameters2/5

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

Schema description coverage is 0%, with one parameter 'id' undocumented in the schema. The description adds minimal semantics by specifying 'by id', but doesn't explain the parameter's role (e.g., unique identifier) or constraints beyond what's implied, failing to compensate for the coverage gap.

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 action ('toggle') and target ('todo by id'), which is clear but minimal. It doesn't distinguish from siblings like 'add_todo' or 'remove_todo' beyond the verb, leaving ambiguity about what 'toggle' specifically does (e.g., mark complete/incomplete).

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 guidance on when to use this tool versus alternatives like 'remove_todo' or how it relates to 'list_todos'. It implies usage for toggling a todo's state but lacks context on prerequisites (e.g., existing todo ID) or exclusions.

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/CalamityAdam/mcp-todo'

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