writeNote
Create or update notes with a unique ID, title, summary, tags, and content on the MCP Notes server for organized and structured documentation.
Instructions
Creates or updates a note with a unique ID suffixed by a random number.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Content of the note | |
| id | Yes | Unique identifier of the note, should be unique enough like "a-note-about-python-file-server-design-109". | |
| summary | Yes | Short summary of the note | |
| tags | Yes | Tags of the note | |
| title | Yes | Title of the note, describe what was inside the content. |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"content": {
"description": "Content of the note",
"type": "string"
},
"id": {
"description": "Unique identifier of the note, should be unique enough like \"a-note-about-python-file-server-design-109\".",
"type": "string"
},
"summary": {
"description": "Short summary of the note",
"type": "string"
},
"tags": {
"description": "Tags of the note",
"items": {
"type": "string"
},
"type": "array"
},
"title": {
"description": "Title of the note, describe what was inside the content.",
"type": "string"
}
},
"required": [
"id",
"title",
"summary",
"tags",
"content"
],
"type": "object"
}
Implementation Reference
- src/notes-mcp-server/handlers.ts:76-109 (handler)The handler function that executes the writeNote tool: puts the note into DynamoDB using PutCommand, updates the ALL_RESOURCES list, and returns a success message.export const handleWriteNote = async ( docClient: DynamoDBDocumentClient, tableName: string, note: Note, ALL_RESOURCES: Resource[] ) => { const command = new PutCommand({ TableName: tableName, Item: note }); await docClient.send(command); const resourceIndex = ALL_RESOURCES.findIndex( (res) => res.uri === `notes://notes/${note.id}` ); const newResource = { uri: `notes://notes/${note.id}`, name: note.title, mimeType: "application/json", text: JSON.stringify(note), }; if (resourceIndex !== -1) { ALL_RESOURCES[resourceIndex] = newResource; } else { ALL_RESOURCES.push(newResource); } return { content: [ { type: "text", text: `Note with ID '${note.id}' has been written/updated.`, }, ], }; };
- src/notes-mcp-server/schemas.ts:3-30 (schema)Zod schema definition for Note (used directly as WriteNoteInputSchema), including id, title, summary, tags, content with descriptions.export const NoteSchema = z.object({ id: z .string() .describe( 'Unique identifier of the note, should be unique enough like "a-note-about-python-file-server-design-109".' ), title: z .string() .describe("Title of the note, describe what was inside the content."), summary: z.string().describe("Short summary of the note"), tags: z.array(z.string()).describe("Tags of the note"), content: z.string().describe("Content of the note"), }); export type Note = z.infer<typeof NoteSchema>; export const ListNotesInputSchema = z.object({ tags: z .array(z.string()) .optional() .describe("Optional tags to filter notes. do not specify this if you didn't certainly sure what tags you want."), }); export const GetNoteInputSchema = z.object({ id: z.string().describe("ID of the note to retrieve"), }); export const WriteNoteInputSchema = NoteSchema;
- src/notes-mcp-server/server.ts:83-86 (registration)Registers the listTools handler which returns the list of tools including writeNote via getTools().server.setRequestHandler(ListToolsRequestSchema, async () => { const tools: Tool[] = getTools(); return { tools }; });
- src/notes-mcp-server/tools.ts:23-28 (registration)Defines the MCP Tool object for writeNote with name, description, and JSON schema converted from Zod.{ name: ToolName.WRITE_NOTE, description: "Creates or updates a note with a unique ID suffixed by a random number.", inputSchema: zodToJsonSchema(WriteNoteInputSchema) as Tool["inputSchema"], },
- src/notes-mcp-server/server.ts:137-140 (handler)Dispatcher in callTool handler that validates input with WriteNoteInputSchema and invokes the handleWriteNote function.case ToolName.WRITE_NOTE: { const note = WriteNoteInputSchema.parse(args); return handleWriteNote(docClient, tableName, note, ALL_RESOURCES); }
- src/notes-mcp-server/types.ts:1-6 (helper)Type definition enum ToolName including WRITE_NOTE = "writeNote" used throughout for tool identification.export enum ToolName { LIST_NOTES = "listNotes", GET_NOTE = "getNote", WRITE_NOTE = "writeNote", DELETE_NOTE = "deleteNote", }