add-note
Add text to your notes file using this MCP Personal Tools Server tool. Append new entries to maintain organized personal documentation.
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 logic for the 'add-note' tool. It creates the notes directory if necessary, appends a timestamped entry with the provided text to 'note.txt', and returns a success or error response.}, 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 defining the 'text' parameter as a string.text: z.string().describe("The text to add to the notes file"),
- src/server.ts:89-114 (registration)The server.tool registration call for the 'add-note' tool, specifying name, description, input schema, hints, and 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` }] }; } })