Skip to main content
Glama

list_todos

Retrieve all todo items in an organized format to view current tasks and track progress efficiently.

Instructions

Return all todos in a structured format.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/server.ts:53-70 (registration)
    Registration of the 'list_todos' tool using server.registerTool, including schema and handler.
    server.registerTool(
      "list_todos",
      {
        title: "List Todos",
        description: "Return all todos in a structured format.",
        inputSchema: {},
        outputSchema: {
          todos: z.array(TodoSchema),
        },
      },
      async () => {
        const todos = await readTodos();
        return {
          structuredContent: { todos },
          content: [{ type: "text", text: JSON.stringify({ todos }, null, 2) }],
        };
      }
    );
  • The handler function for 'list_todos' that reads todos from storage and returns structured content.
    async () => {
      const todos = await readTodos();
      return {
        structuredContent: { todos },
        content: [{ type: "text", text: JSON.stringify({ todos }, null, 2) }],
      };
    }
  • Zod schema for Todo type, used in the outputSchema of list_todos.
    export const TodoSchema = z.object({
      id: z.number().int().positive(),
      title: z.string().min(1),
      done: z.boolean(),
    });
  • Helper function to read todos from the JSON file database.
    async function readTodos(): Promise<Todo[]> {
      try {
        const s = await fs.readFile(DB_PATH, "utf-8");
        return JSON.parse(s);
      } catch {
        return [];
      }
    }
  • Tool metadata including title, description, inputSchema (empty), and outputSchema referencing TodoSchema.
    {
      title: "List Todos",
      description: "Return all todos in a structured format.",
      inputSchema: {},
      outputSchema: {
        todos: z.array(TodoSchema),
      },
    },
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