Skip to main content
Glama
vuluu2k
by vuluu2k

addNote

Add notes to organize ideas or learning content in your structured knowledge base, enabling automated organization and retrieval of information.

Instructions

Add a note to the ideas or learning section

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe note content
fileNoWhich section to add the note toideas

Implementation Reference

  • The core implementation of the addNote functionality, which handles file updates or creation in the brain.
    async addNote(text: string, section: "ideas" | "learning"): Promise<void> {
      const log = getLogger();
      const brainSection: BrainSection = `notes/${section}`;
    
      try {
        await this.sync.atomicUpdate(
          brainSection,
          (current) => appendNote(current, text),
          `feat(ai): add note to ${section}`
        );
        log.info("addNote", { section, text });
      } catch (err) {
        if (isNotFound(err)) {
          const title = section === "ideas" ? "Ideas" : "Learning";
          const content = appendNote(`# ${title}\n\n`, text);
          await this.sync.createSection(
            brainSection,
            content,
            `feat(ai): create ${section} with new note`
          );
          log.info("addNote: created file", { section });
          return;
        }
        throw err;
      }
    }
  • Registration of the "addNote" tool with its schema definition and handler execution.
    server.registerTool(
      "addNote",
      {
        description: "Add a note to the ideas or learning section",
        inputSchema: {
          content: z.string().describe("The note content"),
          file: z
            .enum(["ideas", "learning"])
            .optional()
            .default("ideas")
            .describe("Which section to add the note to"),
        },
      },
      toolHandler("addNote", async ({ content, file }) => {
        await brain.addNote(content, file);
        return { success: true };
      })
    );

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