add_note
Adds a note to a task to preserve context, track progress, and maintain structured information during complex task breakdowns.
Instructions
Adds a note to the task.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | The content of the note |
Implementation Reference
- src/index.ts:955-997 (handler)The handler function that executes the add_note tool logic: validates content, reads task data, appends note with timestamp to notes array, persists to config file, returns success message.private async addNote(args: any): Promise<any> { if (!args?.content) { throw new McpError(ErrorCode.InvalidParams, 'Note content is required'); } try { const taskData = await this.readTaskData(); // Initialize the notes array if it doesn't exist if (!taskData.notes) { taskData.notes = []; } // Add the note taskData.notes.push({ timestamp: new Date().toISOString(), content: args.content }); // Write the updated task data to the file await this.writeTaskData(taskData); return { content: [ { type: 'text', text: 'Note added successfully.', }, ], }; } catch (error) { console.error('Error adding note:', error); return { content: [ { type: 'text', text: `Error adding note: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
- src/index.ts:327-336 (schema)Input schema for the add_note tool, requiring a 'content' string.inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'The content of the note' } }, required: ['content'] }
- src/index.ts:442-443 (registration)Dispatch case in the main tool request handler switch statement that calls the addNote handler for 'add_note' tool.case 'add_note': return await this.addNote(request.params.arguments);
- src/index.ts:324-337 (registration)Tool object in the tools list registered via server.setTools, defining name, description, and input schema for add_note.{ name: 'add_note', description: 'Adds a note to the task.', inputSchema: { type: 'object', properties: { content: { type: 'string', description: 'The content of the note' } }, required: ['content'] } },