add_note
Attach notes to specific projects with details like content and category, using the MCP Project Context Server to maintain persistent project information and eliminate redundant context explanations.
Instructions
Add a note to the project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Note category | |
| content | Yes | Note content | |
| projectId | Yes | Project ID |
Implementation Reference
- src/storage/context-manager.ts:134-152 (handler)Core handler function that retrieves the project, adds a new note object with generated ID, default category if omitted, timestamp, pushes to project.notes array, and persists the update via store.updateProject.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); }
- src/server.ts:279-314 (registration)Registers the 'add_note' MCP tool, providing title, description, Zod input schema validation, and an async handler that calls ContextManager.addNote within try-catch, returning success or error message.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" }`, }, ], }; } } );
- src/types/project-types.ts:66-76 (schema)Zod schema definition for the notes array in ProjectContext, defining the structure of each note (id, content, timestamp, optional category) used when adding notes.notes: z .array( z.object({ id: z.string(), content: z.string(), timestamp: z.string(), category: z.string().optional(), }) ) .default([]), createdAt: z.string(),