delete_note
Remove unwanted notes from your Markdown collection by specifying the filename to delete. This tool helps maintain organized note management by eliminating unnecessary files.
Instructions
Delete a note
Args: filename: Note filename
Returns: Confirmation message of deletion
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | Yes |
Implementation Reference
- notes_server.py:168-186 (handler)The main handler function for the 'delete_note' tool. Decorated with @mcp.tool() which registers it as an MCP tool. Includes type hints (filename: str -> str) and docstring defining the input/output schema. Implements logic to ensure directory exists, check file, remove it, and return confirmation.@mcp.tool() def delete_note(filename: str) -> str: """ Delete a note Args: filename: Note filename Returns: Confirmation message of deletion """ ensure_notes_dir() filepath = os.path.join(NOTES_DIR, filename) if not os.path.exists(filepath): return f"Note '{filename}' not found" os.remove(filepath) return f"Note '{filename}' deleted"
- notes_server.py:11-13 (helper)Supporting helper function called by delete_note to ensure the notes directory exists before attempting to delete a file.def ensure_notes_dir(): """Creates the notes directory if it does not exist""" Path(NOTES_DIR).mkdir(exist_ok=True)
- notes_server.py:168-168 (registration)The @mcp.tool() decorator registers the delete_note function as an MCP tool.@mcp.tool()