Skip to main content
Glama
aaronfeingold

MCP Project Context Server

add_note

Add notes with content and category to projects in the MCP Project Context Server to maintain persistent project information between coding sessions.

Instructions

Add a note to the project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesProject ID
contentYesNote content
categoryNoNote category

Implementation Reference

  • The handler function for the 'add_note' MCP tool. It calls the context manager's addNote method and returns a standardized MCP response with success or error message.
    async ({ projectId, content, category }) => {
      try {
        await this.contextManager.addNote(projectId, content, category);
        return {
          content: [
            {
              type: "text",
              text: "Note added successfully",
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error adding note: ${
                error instanceof Error ? error.message : "Unknown error"
              }`,
            },
          ],
        };
      }
    }
  • Schema definition for the 'add_note' tool, including title, description, and Zod input schema for parameters.
    {
      title: "Add Note",
      description: "Add a note to the project",
      inputSchema: {
        projectId: z.string().describe("Project ID"),
        content: z.string().describe("Note content"),
        category: z.string().optional().describe("Note category"),
      },
    },
  • src/server.ts:279-314 (registration)
    Registration of the 'add_note' tool using server.registerTool, specifying name, schema, and handler.
    this.server.registerTool(
      "add_note",
      {
        title: "Add Note",
        description: "Add a note to the project",
        inputSchema: {
          projectId: z.string().describe("Project ID"),
          content: z.string().describe("Note content"),
          category: z.string().optional().describe("Note category"),
        },
      },
      async ({ projectId, content, category }) => {
        try {
          await this.contextManager.addNote(projectId, content, category);
          return {
            content: [
              {
                type: "text",
                text: "Note added successfully",
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error adding note: ${
                  error instanceof Error ? error.message : "Unknown error"
                }`,
              },
            ],
          };
        }
      }
    );
  • Helper method in ContextManager that implements the logic to add a note to the project's notes array and persist the update.
    async addNote(
      projectId: string,
      content: string,
      category?: string
    ): Promise<void> {
      const project = await this.store.getProject(projectId);
      if (!project) {
        throw new Error("Project not found");
      }
    
      project.notes.push({
        id: uuidv4(),
        content,
        category: category || "general",
        timestamp: new Date().toISOString(),
      });
    
      await this.store.updateProject(project);
    }

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/aaronfeingold/mcp-project-context'

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