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
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID | |
| content | Yes | Note content | |
| category | No | Note category |
Implementation Reference
- src/server.ts:290-313 (handler)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" }`, }, ], }; } }
- src/server.ts:281-289 (schema)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); }