Skip to main content
Glama
cwente25

Knowledge Base MCP Server

by cwente25

delete_note

Remove a note from your knowledge base by specifying its category path and title to maintain organized information.

Instructions

Delete a note from the knowledge base

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_pathYesCategory path (e.g., 'work/clients/acme')
titleYesNote title

Implementation Reference

  • MCP tool handler that extracts arguments and delegates to storage.delete_note, returning success or error message.
    async def handle_delete_note(arguments: dict) -> list[TextContent]:
        """Handle delete_note tool call."""
        try:
            category_path = arguments["category_path"]
            title = arguments["title"]
    
            # Delete note
            result = storage.delete_note(category_path, title)
    
            return [TextContent(type="text", text=result)]
        except (NoteNotFoundError, StorageError) as e:
            return [TextContent(type="text", text=str(e))]
        except Exception as e:
            return [TextContent(type="text", text=f"❌ Error: {str(e)}")]
  • Tool registration in list_tools() including name, description, and input schema.
    Tool(
        name="delete_note",
        description="Delete a note from the knowledge base",
        inputSchema={
            "type": "object",
            "properties": {
                "category_path": {
                    "type": "string",
                    "description": "Category path (e.g., 'work/clients/acme')",
                },
                "title": {
                    "type": "string",
                    "description": "Note title",
                },
            },
            "required": ["category_path", "title"],
        },
    ),
  • Core storage method that locates the note file, creates a backup, deletes the file, and returns confirmation message.
    def delete_note(self, category_path: str, title: str) -> str:
        """
        Delete a note.
    
        Args:
            category_path: Category path (e.g., "work/clients/acme")
            title: Note title
    
        Returns:
            Success message
    
        Raises:
            NoteNotFoundError: If note doesn't exist
        """
        normalized = normalize_path(category_path)
        file_path = self._get_note_path(normalized, title)
    
        if not file_path.exists():
            raise NoteNotFoundError(
                f"❌ Error: Note '{title}' not found in {normalized or 'root'}/\n"
                f"💡 Tip: Use list_notes to see available notes"
            )
    
        # Create backup before deletion
        backup_path = file_path.with_suffix('.md.deleted')
        shutil.copy2(file_path, backup_path)
    
        # Delete the file
        file_path.unlink()
    
        return f"✓ Note '{title}' deleted from {normalized or 'root'}/"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cwente25/KnowledgeBaseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server