add-note
Add a new line to your notes file through the MCP Personal Tools Server. Enter text to store and organize personal notes efficiently.
Instructions
Ajoute une nouvelle ligne au fichier de notes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Le texte à ajouter au fichier de notes |
Implementation Reference
- src/server.ts:97-113 (handler)The main handler function for the 'add-note' tool. It creates the notes directory if needed, appends a timestamped text entry to note.txt in ~/Documents/notes/, and returns a success or error message in MCP content format.}, async ({ text }) => { try { const notesDir = path.join(userHomeDir, 'Documents', 'notes'); // Create the directory if it doesn't exist await fs.mkdir(notesDir, { recursive: true }); // Add the new line to the file await fs.appendFile(path.join(notesDir, 'note.txt'), `${new Date().toISOString()} - ${text}\n`); return { content: [{ type: "text", text: `${text},Note added successfully` }] }; } catch (error) { console.error("Error while adding the note:", error); return { content: [{ type: "text", text: `Error while adding the note` }] }; }
- src/server.ts:90-90 (schema)Zod input schema for the 'add-note' tool, defining a required 'text' string parameter.text: z.string().describe("The text to add to the notes file"),
- src/server.ts:89-114 (registration)Registration of the 'add-note' tool on the MCP server, including description, input schema, metadata hints, and inline handler function.server.tool("add-note", "Add a new line to the notes file", { text: z.string().describe("The text to add to the notes file"), }, { title: "Add Note", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true, }, async ({ text }) => { try { const notesDir = path.join(userHomeDir, 'Documents', 'notes'); // Create the directory if it doesn't exist await fs.mkdir(notesDir, { recursive: true }); // Add the new line to the file await fs.appendFile(path.join(notesDir, 'note.txt'), `${new Date().toISOString()} - ${text}\n`); return { content: [{ type: "text", text: `${text},Note added successfully` }] }; } catch (error) { console.error("Error while adding the note:", error); return { content: [{ type: "text", text: `Error while adding the note` }] }; } })