Skip to main content
Glama
vuluu2k
by vuluu2k

addTask

Create new tasks for today's list or backlog by specifying task descriptions and target locations in a structured knowledge base.

Instructions

Add a new task to today's list or the backlog

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesThe task description
targetNoWhere to add the tasktoday

Implementation Reference

  • The core business logic that adds a task to either the 'today' or 'backlog' section, handling atomic updates and file creation.
    async addTask(text: string, target: "today" | "backlog"): Promise<Task> {
      const log = getLogger();
      const section: BrainSection = `tasks/${target}`;
    
      try {
        const result = await this.sync.atomicUpdate(
          section,
          (current) => appendTask(current, text),
          `feat(ai): add task to ${target}`
        );
        const tasks = parseTasks(result.content, section);
        log.info("addTask", { target, text });
        return tasks[tasks.length - 1];
      } catch (err) {
        if (isNotFound(err)) {
          const title = target === "today" ? "Today" : "Backlog";
          const content = `# ${title}\n\n- [ ] ${text}\n`;
          await this.sync.createSection(
            section,
            content,
            `feat(ai): create ${target} with new task`
          );
          log.info("addTask: created file", { target, text });
          const tasks = parseTasks(content, section);
          return tasks[tasks.length - 1];
  • Tool registration and interface for the 'addTask' MCP tool.
    server.registerTool(
      "addTask",
      {
        description: "Add a new task to today's list or the backlog",
        inputSchema: {
          text: z.string().describe("The task description"),
          target: z
            .enum(["today", "backlog"])
            .optional()
            .default("today")
            .describe("Where to add the task"),
        },
      },
      toolHandler("addTask", async ({ text, target }) => {
        const task = await brain.addTask(text, target);
        return { success: true, task };
      })
    );

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/vuluu2k/knowledge_mcp'

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