deleteNote
Remove a specific note from the MCP Notes server by providing its unique ID, ensuring precise management of stored records.
Instructions
Deletes a specific note by its ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the note to delete |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "ID of the note to delete",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/notes-mcp-server/handlers.ts:111-130 (handler)The core handler function that performs the deletion of a note from the DynamoDB table and updates the ALL_RESOURCES list by removing the deleted note's resource.export const handleDeleteNote = async ( docClient: DynamoDBDocumentClient, tableName: string, id: string, ALL_RESOURCES: Resource[] ) => { const command = new DeleteCommand({ TableName: tableName, Key: { id } }); await docClient.send(command); const index = ALL_RESOURCES.findIndex( (res) => res.uri === `notes://notes/${id}` ); if (index !== -1) { ALL_RESOURCES.splice(index, 1); } return { content: [{ type: "text", text: `Note with ID '${id}' has been deleted.` }], }; };
- Zod input schema for the deleteNote tool, validating the 'id' parameter.export const DeleteNoteInputSchema = z.object({ id: z.string().describe("ID of the note to delete"), });
- src/notes-mcp-server/tools.ts:29-33 (registration)Definition of the MCP 'deleteNote' tool within the getTools() function, specifying name, description, and input schema.{ name: ToolName.DELETE_NOTE, description: "Deletes a specific note by its ID.", inputSchema: zodToJsonSchema(DeleteNoteInputSchema) as Tool["inputSchema"], },
- src/notes-mcp-server/server.ts:142-150 (registration)Dispatch logic in the CallToolRequest handler that parses input and invokes the deleteNote handler.case ToolName.DELETE_NOTE: { const { id: deleteNoteId } = DeleteNoteInputSchema.parse(args); return handleDeleteNote( docClient, tableName, deleteNoteId, ALL_RESOURCES ); }
- src/notes-mcp-server/types.ts:5-5 (helper)Enum definition for the tool name constant 'deleteNote'.DELETE_NOTE = "deleteNote",