Skip to main content
Glama

Add Todo

add_todo

Add a new task to your todo list by providing a title, enabling persistent task management through natural language commands.

Instructions

Add a todo item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes

Implementation Reference

  • The handler function that implements the add_todo tool logic: loads todos, generates next ID, appends new todo with given title (done=false), saves to file, returns success message.
    async ({ title }) => {
      const todos = await readTodos();
      const id = (todos.at(-1)?.id ?? 0) + 1;
      todos.push({ id, title, done: false });
      await writeTodos(todos);
      return { content: [{ type: "text", text: `Added #${id}: ${title}` }] };
    }
  • Input schema definition for the add_todo tool, validating the 'title' parameter as a non-empty string.
    inputSchema: { title: z.string().min(1) },
  • src/server.ts:72-86 (registration)
    The server.registerTool call that registers the 'add_todo' tool with its schema and handler.
    server.registerTool(
      "add_todo",
      {
        title: "Add Todo",
        description: "Add a todo item",
        inputSchema: { title: z.string().min(1) },
      },
      async ({ title }) => {
        const todos = await readTodos();
        const id = (todos.at(-1)?.id ?? 0) + 1;
        todos.push({ id, title, done: false });
        await writeTodos(todos);
        return { content: [{ type: "text", text: `Added #${id}: ${title}` }] };
      }
    );
  • Helper function to read the list of todos from the persistent JSON file, returning empty array if not found.
    async function readTodos(): Promise<Todo[]> {
      try {
        const s = await fs.readFile(DB_PATH, "utf-8");
        return JSON.parse(s);
      } catch {
        return [];
      }
    }
  • Helper function to persist the list of todos to the JSON file.
    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. 'Add a todo item' implies a write operation, but it doesn't disclose behavioral traits such as permissions needed, whether it's idempotent, error handling, or what happens on success (e.g., returns an ID). 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 extremely concise with a single sentence, 'Add a todo item', which is front-loaded and wastes no words. It's appropriately sized for a simple tool, 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 write operation with 1 parameter), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't cover behavioral aspects, parameter details, or return values, making it inadequate for effective agent use without additional context.

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?

The input schema has 1 parameter with 0% description coverage, and the description adds no meaning beyond the schema. It doesn't explain what 'title' represents (e.g., the todo's name or content), its format, or constraints. With low schema coverage, the description fails to compensate, leaving the parameter's semantics unclear.

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 'Add a todo item' clearly states the action (add) and resource (todo item), which is adequate. However, it doesn't differentiate from sibling tools like 'list_todos' or 'remove_todo' beyond the basic verb, making it vague in comparison. It's not tautological but lacks specificity about what 'add' entails versus other operations.

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 like 'list_todos' or 'toggle_todo'. It doesn't mention prerequisites, context, or exclusions. While the verb 'add' implies creation, it fails to specify scenarios or constraints, leaving usage unclear relative to siblings.

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